ghotsong at bigpond.com
Sun Feb 16 02:34:55 CET 2003
"Rene Pijlman" <reageer.in at de.nieuwsgroep> wrote in message
news:gsip4vssatpgmk4dkgrf00f4mvb1blthkg at 4ax.com...
> Lois Hotson:
> >I made a cgi 'upload script' so that I can upload files to my server via
> >web. It seems to work perfectly for ASCII files but binary files dont
> >at all (They make python freeze).
> We'll need to see the actual source code to be able to locate
> the problem.
> >Has anyone had any problems with this kind of thing before?
> Yes, by not opening a binary file as binary.
> René Pijlman
> Wat wil jij leren? http://www.leren.nl
Sorry that I wasn't very specific.
Here's the script source code:
path = r'C:\path\to\upload'
form = cgi.FieldStorage()
item = form["userfile"]
upfile =file(path + '/' +os.path.split(item.filename),'wb')
and heres the form html:
<form method="POST" action="index.py" encType="multipart/form-data">
<input type="file" name="userfile">
<input type="submit" value="Submit">
More information about the Python-list