views:

405

answers:

1

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!

A: 

I am also facing a similar problem for the statement: f = File.new (File.join(RAILS_ROOT, filename))

DatNt