2010-03-18 55 views
1

我在我的開發日誌中得到這個錯誤,而uploadify正在上傳文件,而在視圖中,我在文件名旁邊得到'IO ERROR'。Uploadify with rails on rails'bad content body'500內部服務器錯誤

 
/!\ FAILSAFE /!\ Thu Mar 18 11:54:53 -0500 2010 
    Status: 500 Internal Server Error 
    bad content body 
    /usr/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/utils.rb:351:in `parse_multipart' 
    /usr/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/utils.rb:323:in `loop' 
    /usr/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/utils.rb:323:in `parse_multipart' 
    /usr/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/request.rb:133:in `POST' 
    /usr/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/methodoverride.rb:15:in `call' 
    /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.3/lib/action_controller/params_parser.rb:15:in `call' 
    /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.3/lib/action_controller/session/cookie_store.rb:93:in `call' 
    /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.3/lib/action_controller/reloader.rb:29:in `call' 
    /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.3/lib/action_controller/failsafe.rb:26:in `call' 
    /usr/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/lock.rb:11:in `call' 
    /usr/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/lock.rb:11:in `synchronize' 
    /usr/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/lock.rb:11:in `call' 
    /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.3/lib/action_controller/dispatcher.rb:106:in `call' 
    /usr/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/content_length.rb:13:in `call' 
    /usr/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/handler/fastcgi.rb:58:in `serve' 
    /usr/lib/ruby/gems/1.8/gems/rails-2.3.3/lib/fcgi_handler.rb:103:in `process_request' 
    /usr/lib/ruby/gems/1.8/gems/rails-2.3.3/lib/fcgi_handler.rb:153:in `with_signal_handler' 
    /usr/lib/ruby/gems/1.8/gems/rails-2.3.3/lib/fcgi_handler.rb:101:in `process_request' 
    /usr/lib/ruby/gems/1.8/gems/rails-2.3.3/lib/fcgi_handler.rb:78:in `process_each_request' 
    /usr/lib/ruby/gems/1.8/gems/rails-2.3.3/lib/fcgi_handler.rb:77:in `each' 
    /usr/lib/ruby/gems/1.8/gems/rails-2.3.3/lib/fcgi_handler.rb:77:in `process_each_request' 
    /usr/lib/ruby/gems/1.8/gems/rails-2.3.3/lib/fcgi_handler.rb:76:in `catch' 
    /usr/lib/ruby/gems/1.8/gems/rails-2.3.3/lib/fcgi_handler.rb:76:in `process_each_request' 
    /usr/lib/ruby/gems/1.8/gems/rails-2.3.3/lib/fcgi_handler.rb:51:in `process!' 
    /usr/lib/ruby/gems/1.8/gems/rails-2.3.3/lib/fcgi_handler.rb:23:in `process!' 
    dispatch.fcgi:24 

對此有何看法?

回答

1

我發現這一個,併爲我制定出完美的。


BOUNDARY = "AaB03x" 

def encode_multipartformdata(parameters = {}) 
    ret = String.new 
    parameters.each do |key, value| 
    unless value.empty? 
     ret << "\r\n--" << BOUNDARY << "\r\n" 
     ret << "Content-Disposition: form-data; name=\"#{key}\"\r\n\r\n" 
     ret << value 
    end 
    end 
    ret << "\r\n--" << BOUNDARY << "--\r\n" 
end 
 

已發佈here!祝你好運,如果你有這個問題,我希望這一個適合你!

0

嘗試和應用程序調整Apache的安全設置,把這個在你的虛擬主機配置:

<IfModule mod_security.c> 
    SecFilterEngine Off 
    SecFilterScanPOST Off 
</IfModule> 

有時候這種處理文件的各個部分在/tmp和阻止上傳被完成。