Forum: Ruby on Rails Multi-part file upload read_multipart error

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
96f5de71a8111ed44d251e869270fc03?d=identicon&s=25 Blake Miller (blakeage)
on 2007-05-04 20:59
I'm running Mongrel (and the same thing happens in Webrick mode).

I'm uploading a file via form, and I'm getting the following error:
Error calling Dispatcher.dispatch #<EOFError: bad content body>
/usr/local/lib/ruby/1.8/cgi.rb:984:in `read_multipart'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/cgi_ext/raw_post_data_fix.rb:38:in
`initialize_query'

I'm able to upload files fine from other forms in the site, but when I
upload on a specific page, I get that error.

Here is the generated html source for the upload form:
<form action="/admin/cl_master/ajax_like_approve_with_alternate/752"
enctype="multipart/form-data" method="post" target="frame">
  <input id="_752_field" name="[752_field]" size="10" type="file" />
  <div id="752_awa_button_container">
    <input id="752_awa_button" onclick="PreFormSubmit(this.form, 'awa',
752);" type="button" value="Approve" />
  </div>
</form>

"frame" is an iframe, but I get the same error posting without the
target designation.

The action in the controller does nothing:
def ajax_like_approve_with_alternate
    # Do stuff with params[:uploaded_file]
    #data = ClData.find( params[:id] )

    #responds_to_parent do
    #  render :update do |page|
    #    page << "ResponseHandler( #{params[:id]}, 'awa', 1 )"
    #  end
    #end
end


The only difference I can see between other pages on the site is that
other pages don't specify a target for the form (which again, doesn't
help the problem), and the page that is causing the errors has many
forms on it (NOTE: I've checked to be sure none of them are embedded
within another).
50fee291eabe632fb36c9dfc81728ab4?d=identicon&s=25 Des (Guest)
on 2007-06-22 21:38
(Received via mailing list)
Have you resolved this problem? I had now just exactly the same
(upload, iframe, same error and working on some pages) and the
solution was that the real root of problem was the next after
uploading ajax request which does terminated the upload process by
this line:

for (var i = 0; i < as_requests.length; i++) as_requests[i].abort();
50fee291eabe632fb36c9dfc81728ab4?d=identicon&s=25 Des (Guest)
on 2007-06-22 21:39
(Received via mailing list)
Have you resolved this problem? I had now just exactly the same
(upload, iframe, same error and working on some pages) and the
solution was that the real root of problem was the next after
uploading ajax request which does terminated the upload process by
this line:

for (var i = 0; i < as_requests.length; i++) as_requests[i].abort();

Des

On May 4, 9:59 pm, Blake Miller <rails-mailing-l...@andreas-s.net>
96f5de71a8111ed44d251e869270fc03?d=identicon&s=25 Blake Miller (blakeage)
on 2007-06-22 22:13
Des wrote:
> Have you resolved this problem? I had now just exactly the same
> (upload, iframe, same error and working on some pages) and the
> solution was that the real root of problem was the next after
> uploading ajax request which does terminated the upload process by
> this line:
>
> for (var i = 0; i < as_requests.length; i++) as_requests[i].abort();
I did not resolve it yet (haven't worked on it for a while).
This topic is locked and can not be replied to.