Problem uploading files

Hello, i have problem when i upload files to the website, i can’t
understand it. I use Apache 2 + Ubuntu, and Apache returns Error 500
(captured by the application)

I use attachment and shared-mime-info and i don’t understand why don’t
work, temp files are written with 600, and not 644 :S

Sometimes use /tmp/CGI* other times use /rails_dir/tmp/attachment_fu :S

I use Apache 2.2 + mod_rails + attachment_fu + shared-mime-info + rails
2.2.2

the production.log is this:


ERROR ERROR ERROR - /rails_dir/log/production.log - Thank you for the
help!


NoMethodError (undefined method match_filename?' for nil:NilClass): /app/models/user_file.rb:38:inset_content_type_by_content’
/usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/associations/association_proxy.rb:214:in
send' /usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/associations/association_proxy.rb:214:inmethod_missing’
/app/controllers/account_controller.rb:352:in save' /app/controllers/account_controller.rb:72:inregister’
/usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/base.rb:1253:in
send' /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/base.rb:1253:inperform_action_without_filters’
/usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/filters.rb:617:in
call_filters' /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/filters.rb:610:inperform_action_without_benchmark’
/usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/benchmarking.rb:68:in
perform_action_without_rescue' /usr/lib/ruby/1.8/benchmark.rb:293:inmeasure’
/usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/benchmarking.rb:68:in
perform_action_without_rescue' /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/rescue.rb:136:inperform_action_without_caching’
/usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/caching/sql_cache.rb:13:in
passenger_orig_perform_action' /usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/connection_adapters/abstract/query_cache.rb:34:incache’
/usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/query_cache.rb:8:in
cache' /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/caching/sql_cache.rb:12:inpassenger_orig_perform_action’
/var/lib/gems/1.8/gems/passenger-2.2.5/lib/phusion_passenger/railz/request_handler.rb:65:in
perform_action' /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/base.rb:524:insend’
/usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/base.rb:524:in
process_without_filters' /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/filters.rb:606:inprocess_without_session_management_support’
/usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/session_management.rb:134:in
process' /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/base.rb:392:inprocess’
/usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:183:in
handle_request' /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:110:indispatch_unlocked’
/usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:123:in
dispatch' /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:122:insynchronize’
/usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:122:in
dispatch' /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:132:indispatch_cgi’
/usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:39:in
dispatch' /var/lib/gems/1.8/gems/passenger-2.2.5/lib/phusion_passenger/railz/request_handler.rb:50:inprocess_request’
/var/lib/gems/1.8/gems/passenger-2.2.5/lib/phusion_passenger/abstract_request_handler.rb:207:in
main_loop' /var/lib/gems/1.8/gems/passenger-2.2.5/lib/phusion_passenger/railz/application_spawner.rb:378:instart_request_handler’
/var/lib/gems/1.8/gems/passenger-2.2.5/lib/phusion_passenger/railz/application_spawner.rb:336:in
handle_spawn_application' /var/lib/gems/1.8/gems/passenger-2.2.5/lib/phusion_passenger/utils.rb:183:insafe_fork’
/var/lib/gems/1.8/gems/passenger-2.2.5/lib/phusion_passenger/railz/application_spawner.rb:334:in
handle_spawn_application' /var/lib/gems/1.8/gems/passenger-2.2.5/lib/phusion_passenger/abstract_server.rb:352:insend
/var/lib/gems/1.8/gems/passenger-2.2.5/lib/phusion_passenger/abstract_server.rb:352:in
main_loop' /var/lib/gems/1.8/gems/passenger-2.2.5/lib/phusion_passenger/abstract_server.rb:196:instart_synchronously’
/var/lib/gems/1.8/gems/passenger-2.2.5/lib/phusion_passenger/abstract_server.rb:163:in
start' /var/lib/gems/1.8/gems/passenger-2.2.5/lib/phusion_passenger/railz/application_spawner.rb:213:instart’
/var/lib/gems/1.8/gems/passenger-2.2.5/lib/phusion_passenger/spawn_manager.rb:262:in
spawn_rails_application' /var/lib/gems/1.8/gems/passenger-2.2.5/lib/phusion_passenger/abstract_server_collection.rb:126:inlookup_or_add’
/var/lib/gems/1.8/gems/passenger-2.2.5/lib/phusion_passenger/spawn_manager.rb:256:in
spawn_rails_application' /var/lib/gems/1.8/gems/passenger-2.2.5/lib/phusion_passenger/abstract_server_collection.rb:80:insynchronize’
/var/lib/gems/1.8/gems/passenger-2.2.5/lib/phusion_passenger/abstract_server_collection.rb:79:in
synchronize' /var/lib/gems/1.8/gems/passenger-2.2.5/lib/phusion_passenger/spawn_manager.rb:255:inspawn_rails_application’
/var/lib/gems/1.8/gems/passenger-2.2.5/lib/phusion_passenger/spawn_manager.rb:154:in
spawn_application' /var/lib/gems/1.8/gems/passenger-2.2.5/lib/phusion_passenger/spawn_manager.rb:287:inhandle_spawn_application’
/var/lib/gems/1.8/gems/passenger-2.2.5/lib/phusion_passenger/abstract_server.rb:352:in
__send__' /var/lib/gems/1.8/gems/passenger-2.2.5/lib/phusion_passenger/abstract_server.rb:352:inmain_loop’
/var/lib/gems/1.8/gems/passenger-2.2.5/lib/phusion_passenger/abstract_server.rb:196:in
`start_synchronously’
/var/lib/gems/1.8/gems/passenger-2.2.5/bin/passenger-spawn-server:61

(23 Nov 18:44): [account.register] anonymous: HTTP 500 - .


INSTALLED GEMS - sudo gem list - Thank you for the help!


*** LOCAL GEMS ***

actionmailer (2.2.2)
actionpack (2.2.2)
activerecord (2.2.2)
activeresource (2.2.2)
activesupport (2.3.4, 2.2.2)
archive-tar-minitar (0.5.2)
cgi_multipart_eof_fix (2.5.0)
color (1.4.0)
facets (2.6.0)
fastthread (1.0.7)
flay (1.4.0)
flog (2.2.0)
gem_plugin (0.2.3)
hoe (2.3.3)
jscruggs-metric_fu (1.1.1)
json_pure (1.1.9)
login_generator (1.2.2)
mojombo-chronic (0.3.0)
mysql (2.7)
passenger (2.2.5)
pdf-writer (1.1.8)
rails (2.2.2)
rake (0.8.7)
RedCloth (4.2.0)
relevance-rcov (0.9.2.1)
rmagick (2.9.2)
ruby_parser (2.0.4)
rubyforge (2.0.3)
sexp_processor (3.0.3)
shared-mime-info (0.1)
spreadsheet-excel (0.3.5.1)
topfunky-gruff (0.3.5)
transaction-simple (1.4.0)


Log uploaded there:
http://gist.github.com/241194

Penguin Junior wrote:

NoMethodError (undefined method `match_filename?’ for nil:NilClass):

/app/controllers/account_controller.rb:352:in `save'
/app/controllers/account_controller.rb:72:in `register'

Why are you using match_filename? Where? Does the method exist? Should
it exist?

Aldric G. wrote:

Penguin Junior wrote:

NoMethodError (undefined method `match_filename?’ for nil:NilClass):

/app/controllers/account_controller.rb:352:in `save'
/app/controllers/account_controller.rb:72:in `register'

Why are you using match_filename? Where? Does the method exist? Should
it exist?

It’s a method of shared-mime-info

And exist.

The problem it’s that try to apply a incorrect file (nil).

attachment_fu random upload the files to /tmp (like CGIXXX) or
/raildir/tmp/attachment_fu and fails!

Ah!

The permission with upload it are 600 (must be 644).