Not getting all keys in FieldStorage (Multipart form data)
maxm at mxm.dk
Wed Jun 4 13:58:56 CEST 2003
vivek kumar wrote:
> 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/additem.py?bookid=%s&image=yes" 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>'
Here you are mixing stuff:
you should not pass parameters as part of the action.
Do it as a hidden field instead.
<input type="hidden" name="bookid" value="%s">
> 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...
I think it is undefined what happens in this case. Most likely the
browser ignores the parameteres in your action, and just add those from
the form itself.
Anyway it isn't legal.
hilsen/regards Max M Rasmussen, Denmark
Fremtiden, videnskab, skeptiscisme og transhumanisme
More information about the Python-list