[mod_python] Form upload

jaba at findyourcore.com jaba at findyourcore.com
Fri May 19 22:52:29 EDT 2006


Thank you so much. You have saved me loads of time.

> You probably forgot to set the encoding type of the form:
>
> <form enctype="multipart/form-data" method="POST"
> action="upload.psp?doit=yes">
>
> Without the enctype="multipart/form-data" part, the browser will only send
> the filename and not the
> contents.
>
> --
> Mike Looijmans
> Philips Natlab / Topic Automation
>
>
> jaba at findyourcore.com wrote:
>> heres my code:
>>
>> #########upload.py#########
>>
>> from mod_python import util
>> import sys
>> def handler(req):
>>     sys.stdout=sys.stderr=req
>>     form=util.FieldStorage(req)
>>     if form.has_key("file"):print form.list[0].file.getvalue()
>>     print "<form method=post><input type=file name=file></form>"
>>
>> ###########################
>>
>> the problem is, it only returns the filename, not the file contents.
>> Whats wrong?
>> _______________________________________________
>> 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