Rails - Permission denied when try to save uploaded file in windows

Posted by logoin on Stack Overflow See other posts from Stack Overflow or by logoin
Published on 2009-06-11T07:00:02Z Indexed on 2010/06/16 6:32 UTC
Read the original article Hit count: 245

Filed under:

I'm writing my own file upload in rails. I saw some related questions but it doesn't answer my question. I use

File.open ("#{RAILS_ROOT}/public/docs/attachments/#{@file_name}", "wb") {|f| f.write(@temp_file.read)}

to write the file on my local machine (OS: Windows XP) instead of saving it in database. I got a Permission denied error on the File.open method. Since I have cygwin installed, I chmod 777 the folder that files should write to and also make sure the file I upload can be read. But I'm still getting the same error. Any ideas? Thanks!

© Stack Overflow or respective owner

Related posts about ruby-on-rails