[mod_python] StringField instead of Field object on file upload form with method="get"

Bram bram-lists at phoenux.org
Mon May 9 11:49:59 EDT 2005


Duh,

Sorry I found my own answer. req.form

I apologize for this question.

Thanks,
Bram Swenson.

Bram wrote:

> Hello all,
>
> I have a HTML form that look similar to this:
>
> <form action="/py/upload_form" enctype="multipart/form-data" 
> method="get">
>      <input type="hidden" name="user_id" value="<%=user_id%>"></input>
>    # PSP style template fills in user_id
>      <li>Select your file :  <input type="file" 
> name="filedata"></input> *</li>
>      <li class="upload_button"><input type="submit" value="Upload" 
> name="upload" id="upload"></input></li>
>
> </form>
>
> Then the upload_form.py file uses mod_python.util.FieldStorage to 
> access the form values:
>
> from mod_python import util
>
> def handler(req):
>    form_values = util.FieldStorage(req)
>
> There are two things I am not understanding. One is that when the form 
> method is set to post (as I think it should be) form_values is empty. 
> But when I use "get" as I have shown above, the form_values object 
> exists and has the correct data. This then leads to my second problems 
> which is that when I use this method, form_values["filedata"] is 
> StringField( ) object  instead of Field( ) object as excpected.
>
> I mention both of the issues together as I suspect they are related. I 
> suspect also that I a missing something simple, but I cannot put my 
> finger on it.
>
> Thanks in advance,
> Bram Swenson.
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python




More information about the Mod_python mailing list