File upload doesn't work in production mode


#1

Can anyone understand what the production.log file is telling me. I’ve
tried playing with the permissions for the folders and it makes no
difference. Every time I submit the form to upload the file I get
“Application error (Rails)” which doesn’t really help.

Processing DocsController#create (for 82.152.151.194 at 2006-04-12
12:44:13) [POST]
Session ID: b27441574a2e76188be2b59b3572affb
Parameters: {“commit”=>“Save and continue”,
“doc”=>{“filename_temp”=>"", “filename”=>#StringIO:0xb70d8118,
“label”=>“test”}, “action”=>“create”, “controller”=>“admin/docs”}

Errno::EACCES (Permission denied -
/var/www/html/hjplaw.co.uk/current/public/…/config/…/public/doc/filename/tmp/1144842253.766011.302):
/usr/local/lib/ruby/1.8/fileutils.rb:243:in mkdir' /usr/local/lib/ruby/1.8/fileutils.rb:243:infu_mkdir’
/usr/local/lib/ruby/1.8/fileutils.rb:172:in mkdir' /usr/local/lib/ruby/1.8/fileutils.rb:171:inmkdir’
/vendor/plugins/file_column/lib/file_column.rb:216:in store_upload' /vendor/plugins/file_column/lib/file_column.rb:150:inupload’
/vendor/plugins/file_column/lib/file_column.rb:70:in assign' /vendor/plugins/file_column/lib/file_column.rb:652:infilename=’
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/active_record/base.rb:1506:in
attributes=' /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/active_record/base.rb:1505:inattributes=’
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/active_record/base.rb:1350:in
initialize_without_callbacks' /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/active_record/callbacks.rb:236:ininitialize’
/app/controllers/admin/docs_controller.rb:20:in create' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.0/lib/action_controller/base.rb:908:inperform_action_without_filters’
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.0/lib/action_controller/filters.rb:355:in
perform_action_without_benchmark' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.0/lib/action_controller/benchmarking.rb:69:inperform_action_without_rescue’
/usr/local/lib/ruby/1.8/benchmark.rb:293:in measure' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.0/lib/action_controller/benchmarking.rb:69:inperform_action_without_rescue’
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.0/lib/action_controller/rescue.rb:82:in
perform_action' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.0/lib/action_controller/base.rb:379:inprocess_without_filters’
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.0/lib/action_controller/filters.rb:364:in
process_without_session_management_support' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.0/lib/action_controller/session_management.rb:117:inprocess’
/usr/local/lib/ruby/gems/1.8/gems/rails-1.1.0/lib/dispatcher.rb:38:in
dispatch' /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.0/lib/fcgi_handler.rb:150:inprocess_request’
/usr/local/lib/ruby/gems/1.8/gems/rails-1.1.0/lib/fcgi_handler.rb:54:in
process!' /usr/local/lib/ruby/gems/1.8/gems/fcgi-0.8.6.1/./fcgi.rb:600:ineach_cgi’
/usr/local/lib/ruby/gems/1.8/gems/fcgi-0.8.6.1/./fcgi.rb:597:in
each_cgi' /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.0/lib/fcgi_handler.rb:53:inprocess!’
/usr/local/lib/ruby/gems/1.8/gems/rails-1.1.0/lib/fcgi_handler.rb:23:in
`process!’
/var/www/html/hjplaw.co.uk/current/public/dispatch.fcgi:24


#2

From the tmp/sessions directory you can try deleting the files created
there.


#3

I deleted the tmp/sessions files and restarted the server and
unfortunately it’s still doing the same as before.


#4

Its really strange then…whats your OS? What permissions you are using?
Just
make sure that tmp and log directory are writable. Also, where exactly
you
are saving files uploaded with file_column plugin? Do, you have write
permissions there?

Looks like, you are having problems with file_column plugin?

You will have to post full stacktrace…only then we can help!!.


#5

ok i figured it out. basically i had uploaded my local /public/doc
folder to the production server. so file_column was throwing up the
errors because it didn’t like that the folders it was going to create
already existed.

hopefully posting this up will help save time for anyone else who gets
baffled by this error.


#6

it is the file_column plugin you are right and it works fine in other
areas of my application. the file upload works fine locally on my
windows machine in development mode. it’s just the move to production
onto the linux server when it breaks.

permissions are set at 775 for all folders i can see are involved in
the upload process. the file gets saved to /public/doc/filename/ID