upload file via form
java at dejazzd.com
Tue Dec 4 18:57:55 CET 2001
See my notation in your cgi code below, marked -->
That'll stuff the file into the response back to the browser. If you
want to do things like properly handle images, etc., you need to do a
Iddo Friedberg <idoerg at cc.huji.ac.il> wrote in message news:<Pine.GSO.4.40_heb2.09.0112040921370.5804-100000 at new-shum>...
> This seems like a FAQ, but looking at the newsgroups, manuals etc. I could
> not find a reference to this.
> I am trying to load a file to the server via a form.
> import cgi
> form = cgi.FieldStorage()
> if form['userfile'].file:
> contents = form['userfile'].file.value
-->contents = form['userfile'].value
> contents = "Nothing here!"
> print "Content-type: text/html"
> print "<pre>"
> print contents
> print "</pre>"
More information about the Python-list