Uploading files from IE

AB amy-g-art at cox.net
Wed Mar 22 16:27:20 EST 2006


All right... I already hated IE.  But, now I do even more.  My scripts 
upload function is working in Firefox, but not in IE.  If I upload a file 
from Internet Explorer I get a file on the system named for the full path 
from the users computer...

example...
They user uploads C:\mydocs\test.jpg
it ends up at /path/to/webdir/C:\mydocs\test.jpg
instead of /path/to/webdir/test.jpg

This only happens in IE.  Firefox, Safari, Opera... all work fine.

This code is to show how I am going about getting the name... not the actual 
code from my program.

upload_dir = "/path/to/webdir/"
myForm = cgi.FieldStorage
ulImage = myForm["ulImage"]
myName = ulImage.filename
newFile = file (os.path.join(upload_dir, myName), 'wb')
while 1:
    chunk = ulImage.file.read(100000)
    if not chunk: break
    newFile.write(chunk)
newFile.close()


Thanks for any help.
AG 





More information about the Python-list mailing list