[mod_python] How to find a filename

Clodoaldo clodoaldo.pinto.neto at gmail.com
Sat Jan 20 07:14:59 EST 2007


2007/1/20, export at hope.cz <export at hope.cz>:
>
>
> I have a form through which users upload a file.
>
>
> <form method="post" action="test/mptest.py" enctype="multipart/form-data">
>   <p><input type="file" name="Picture"> </p>
> </form>
> </body>
>
>
> Is it possible to find out the name of a file the user is being uploaded?
> I could not find it .I tried req.headers_in but I failed.

I think this works:

fileitem = req.form.get('Picture', None)
if fileitem:
    picture_name = fileitem.filename

Regards,
-- 
Clodoaldo Pinto Neto


More information about the Mod_python mailing list