cgi type=file problems

Dag Dag at animagicnet.no
Mon Sep 3 05:11:26 EDT 2001


I have a HTML form with a type=file input element and I simply want to
get the file name as a string.  I'm not interested in the actual file.  
However the value from the file part of the form doesn't seem to get
passed at all. 
For example I have the following form and script;

<form action="/cgi-bin/cgi-test.py" method="post">
<input type="file" name="filetest"><BR> 
<input type="text" name="texttest"> 
<input type="submit"> 
</form>

#!/usr/bin/python
import cgi
form=cgi.FieldStorage()
#other stuff
print form

When I enter a filename and text string into the form, the above code
returns;

FieldStorage(None, None, [MiniFieldStorage('texttest', 'abc')])

So what happened to my "filetest" value?

Dag



More information about the Python-list mailing list