[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

File upload works fine in FF, Crashes server in IE

Sina Iman

1/16/2008 10:43:00 PM

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-...attachment/1314/...

--
Posted via http://www.ruby-....

1 Answer

Sina Iman

1/17/2008 3:53:00 PM

0

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!
--
Posted via http://www.ruby-....