upload file with cgi

Michael P. Reilly arcege at shore.net
Sun Jul 18 08:45:52 EDT 1999


Sim & Golda Zacks <simngolda at voyager.net> wrote:
: I am uploading a file using the cgi module and I can not figure out how
: to get the name of the file.
: The code I am using is
: form=cgi.FieldStorage()
: pic=form["picture"]
: Now when I print pic it gives me the name of the File  and the actual
: file.
: When I get pic.value it is the actual picture.
: pic.key doesn't give me anything and I have absolutely no clue how to
: get the filename.

: Please help.

There should be a "filename" attribute along with the "file" object.
  print 'You gave me the file:', pic.filename

  -Arcege





More information about the Python-list mailing list