This is driving me swiftly insane.

I'm working on a page that uploads images. I've tried a few ways of
pulling the file data out of the request and writing it to disk, but it
always ends up corrupted and/or truncated (I'm not sure which)

The form sets enctype="multipart/form-data". The input in the form is
named "file".

Here's a condensed version of the code I'm currently trying:

uploadedFile = self.request().field("file", None).file               
uploadedFile.seek(0)
fileContents = uploadedFile.read()
file("/tmp/file.jpg", 'wb').write(fileContents)

I've tried a while loop that read line by line, pulling the string out
of the FieldStorage object, nothing seems to work.

I'm uploading from Opera 7.23, though I've tried Mozilla as well. I'm
running Webware 8.1 with the apache2 adapter.

Any ideas?

-Ken Brown



-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g. 
Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
_______________________________________________
Webware-discuss mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-discuss

Reply via email to