Ken,

I have also had this problem of file corruption in uploads. For me it only happens when I am using Safari on my Mac; it works fine on IE 6 on Windows. Clearly Safari's file upload could not be broken for the general case. If it was then Apple would have patched it by now. Therefore I think there is something about the way that Safari does the upload that provokes a bug in w4py.

When I have seen the corruption in text files I have noticed that it is not randomly corrupting characters. Rather, bits of the file were missing or repeated (I'm not sure which.)


Oliver

--
On 20/05/2004, at 08:29, Kenneth Brown wrote:

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



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