# Multi-part file upload read\_multipart error

**URL:** <https://www.ruby-forum.com/t/multi-part-file-upload-read-multipart-error/103371>\
**Category:** Rails\
**Created:** [May 4, 2007, 8:59pm UTC](https://www.ruby-forum.com/t/multi-part-file-upload-read-multipart-error/103371 "2007-05-04T20:59:05Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![blakeage](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/b38774/32.png) [@blakeage](https://www.ruby-forum.com/u/blakeage)\
**Post date:** [May 4, 2007, 8:59pm UTC](https://www.ruby-forum.com/t/multi-part-file-upload-read-multipart-error/103371/1 "2007-05-04T20:59:05Z")

</div>

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:

“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).

---

<div class="post-metadata">

**Author:** ![blakeage](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/b38774/32.png) [@blakeage](https://www.ruby-forum.com/u/blakeage)\
**Post date:** [June 22, 2007, 9:38pm UTC](https://www.ruby-forum.com/t/multi-part-file-upload-read-multipart-error/103371/2 "2007-06-22T21:38:30Z")

</div>

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();

---

<div class="post-metadata">

**Author:** ![blakeage](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/b38774/32.png) [@blakeage](https://www.ruby-forum.com/u/blakeage)\
**Post date:** [June 22, 2007, 9:39pm UTC](https://www.ruby-forum.com/t/multi-part-file-upload-read-multipart-error/103371/3 "2007-06-22T21:39:31Z")

</div>

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 M. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![blakeage](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/b38774/32.png) [@blakeage](https://www.ruby-forum.com/u/blakeage)\
**Post date:** [June 22, 2007, 10:13pm UTC](https://www.ruby-forum.com/t/multi-part-file-upload-read-multipart-error/103371/4 "2007-06-22T22:13:24Z")

</div>

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).
