Not getting all keys in FieldStorage (Multipart form data)

vivek kumar gupt_vive at
Wed Jun 4 11:26:34 CEST 2003

Hi all,

  Here is one problem I am facing while loading multipart form data. Like I 
have code for creating form for loading images..

print '<form name="bookimage" 
action="%s/admin/" method="post" 
enctype="multipart/form-data">' %(environ.ENV_PATH,itemid)
print '<font size=4>Book Cover Image : <input type="file" name="book_image" 
size=50><br><br><input type="submit" value="Load Image">'
print '</form>'

But when I try to retrive the bookid key from FieldStorage then it raises a 
Key error :-(. The code where I am trying to get this...

         if form.has_key("book_image"):
                from os.path import splitext

I have tried to print the contents of the FieldStorage Object also like..

            if form.has_key("book_image"):
                print 'content-type:text/html\n'
                print form

But here also it shows only the book_image key and data.

Is this because I am using multipart form data type or there is some error 
with the code??
If it is because of multipart form data then how can I pass an ID or some 
other value with the image??

TIA and Kind Regards
Vivek Kumar

Watch Hallmark. Enjoy cool movies Win hot prizes!

More information about the Python-list mailing list