File upload works fine in FF, Crashes server in IE

S

Sina Iman

I made a file upload system.

It works perfectly in Firefox, with both large and small files
(Tempfiles and StringIO) being copied into the appropriate server
directory.

The uploading works the same in IE too, for small files that have the
type of StringIO. For some reason, when I upload a large file through IE
(meaning a file large enough to be handled as a Tempfile by Ruby) the
parameter sent over is a humongous plaintext string that I can only
assume is the plaintext representation of the binary file data. This
string is very large and crashes my server.

Please help.

View (imagine it like this, there's actually alot of javascript for the
multiple upload thing, and also file input decoration):

<form action="/upload" enctype="multipart/form-data" id="uploadForm"
method="post" name="uploadForm">

<input type="file" id='_fileinputbox' name="content[uploaded_data][0]"
class="file" />
<input type="file" name="content[uploaded_data][1]" class="file" />
<input type="file" name="content[uploaded_data][2]" class="file" />
<input type="file" name="content[uploaded_data][3]" class="file" />

<input type="image" src="http://localhost:3000/images/upload_box.gif"
style="margin-right: 5px;border:0px;" />

</form>


Controller (this is a handler for multiple files):

params['content']['uploaded_data'].each { |v|

if v[1].to_s == ""
next
end

valid = true
# SET TO NULL_PROJECT of id 0, since we will set project id
later
content = Content.new:)project_id => 0)
content.upload_salt = salt
content.save!

post = DataFile.save(v[1], content.content_id.to_i.to_s)
content.content_url = post
content.content_type = DataFile.get_type(content.content_url)
content.original_filename =
DataFile.sanitize_filename(v[1].original_filename)
content.content_add_date = Time.now
content.save!

}


The screenshot is of the console output when I attempted to upload a
4.5MB file through Internet Explorer

Attachments:
http://www.ruby-forum.com/attachment/1314/dammit.png
 
S

Sina Iman

I've narrowed it down a bit:

IE will only pass this HUGE string when a SWF-type file is
uploaded...Everything else, big or small works...just no SWFs!!

What?!!

Please help!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top