Re: desperate, errors with file upload

Frederick Cheung
Wed, 01 Jun 2011 12:54:04 -0000

On Jun 1, 10:51 am, PeterI <p...-2anF5v0VQHHQT0dZR+AlfA@public.gmane.org>
wrote:
> hello,
>
> i implementing a file upload using paperclip plugin. i getting the
> following error [1] when uploading a file. I''m using the gems
rails
> v2.3.8 and paperclip v2.1.6. the parameter hash looks like [2], the
> model like [3].
>

> Interesting is that i get two different errors, on the localhost with
> webrick it says:
>
> Status: 500 Internal Server Error
>   no marshal_dump is defined for class Proc
>     /var/lib/gems/1.8/gems/activesupport-2.3.8/lib/active_support/
> message_verifier.rb:38:in `dump''
>
> on the server (same setup):
>
> Status: 500 Internal Server Error
>   can''t dump File
>     /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/
> message_verifier.rb:38:in `dump''
>
> any hints?
> thx

This sounds like your controller is putting something in the session
which can''t be serialized (such as a file or proc object)

Fred
>
> [2] Processing UploadItemController#create (for 84.119.78.19 at
> 2011-06-01 11:42:48) [POST]
>   Parameters: {"commit"=>"Upload",
"action"=>"create",
>
"authenticity_token"=>"o5Dbbzd0CA45UpNQ++mQw5gQtoUkmbBT2UEP3FuPAbM=",
> "controller"=>"upload_item",
"upload_item"=>{"title"=>"dddd",
> "upload"=>#<File:/tmp/RackMultipart7503-0>,
"upload_rules"=>"0",
> "description"=>"dsf"}}
> Redirected tohttp://ichsehichseh.wirdorange.org/upload_items/new
> Completed in 298ms (DB: 26) | 302 Found [http://
> ichsehichseh.wirdorange.org/upload_items]
>
> [1]
> /!\ FAILSAFE /!\  Wed Jun 01 11:42:48 +0200 2011
>   Status: 500 Internal Server Error
>   can''t dump File
>     /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/
> message_verifier.rb:38:in `dump''
>     /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/
> message_verifier.rb:38:in `generate''
>     /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controller/
> session/cookie_store.rb:157:in `marshal''
>     /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controller/
> session/cookie_store.rb:106:in `call''
>     /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controller/
> failsafe.rb:26:in `call''
>     /usr/lib/ruby/1.8/rack/lock.rb:11:in `call''
>     /usr/lib/ruby/1.8/rack/lock.rb:11:in `synchronize''
>     /usr/lib/ruby/1.8/rack/lock.rb:11:in `call''
>     /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controller/
> dispatcher.rb:106:in `call''
>     /usr/lib/ruby/1.8/phusion_passenger/rack/request_handler.rb:92:in
> `process_request''
>     /usr/lib/ruby/1.8/phusion_passenger/abstract_request_handler.rb:
> 207:in `main_loop''
>     /usr/lib/ruby/1.8/phusion_passenger/railz/application_spawner.rb:
> 441:in `start_request_handler''
>     /usr/lib/ruby/1.8/phusion_passenger/railz/application_spawner.rb:
> 381:in `handle_spawn_application''
>     /usr/lib/ruby/1.8/phusion_passenger/utils.rb:252:in
`safe_fork''
>     /usr/lib/ruby/1.8/phusion_passenger/railz/application_spawner.rb:
> 377:in `handle_spawn_application''
>     /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:352:in
> `__send__''
>     /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:352:in
> `main_loop''
>     /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:196:in
> `start_synchronously''
>     /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:163:in
> `start''
>     /usr/lib/ruby/1.8/phusion_passenger/railz/application_spawner.rb:
> 222:in `start''
>     /usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:253:in
> `spawn_rails_application''
>     /usr/lib/ruby/1.8/phusion_passenger/abstract_server_collection.rb:
> 126:in `lookup_or_add''
>     /usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:247:in
> `spawn_rails_application''
>     /usr/lib/ruby/1.8/phusion_passenger/abstract_server_collection.rb:
> 80:in `synchronize''
>     /usr/lib/ruby/1.8/phusion_passenger/abstract_server_collection.rb:
> 79:in `synchronize''
>     /usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:246:in
> `spawn_rails_application''
>     /usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:145:in
> `spawn_application''
>     /usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:278:in
> `handle_spawn_application''
>     /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:352:in
> `__send__''
>     /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:352:in
> `main_loop''
>     /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:196:in
> `start_synchronously''
>     /usr/lib/phusion_passenger/passenger-spawn-server:61
>
> [3]
> has_attached_file :upload,
>                     :styles => { :thumb => { :geometry =>
"200x200>",
>                                            :format => :png }},
>                     :whiny => false
>
>   validates_attachment_content_type :upload,
>                                       :content_type =>
[''image/jpeg'',
>                                         ''image/png'',
>                                         ''image/gif'',
>                                         ''image/pjpeg'',
>                                         ''image/x-png'',
>                                         ''image/jpeg2000'',
>
''application/pdf''], :message
> => ''Uploaded file is not an image nor pdf''