[mod_python] How could i use FieldStorage class, is there any example?

hoxide hoxide_dirac at yahoo.com.cn
Thu Aug 12 01:22:01 EDT 2004


I'm trying to access the form data with FieldStorage class, but after I submited the form,
it didn't get any data.

in the html:
<form  enctype="multipart/form-data" name="form1" id="form1" method="POST" action="/bin/admin/addimg">
    <input type="text" name="tb"  id= "tb"/>
    <textarea name="textarea">jjkjkjijkj</textarea>
    <input type="file" name="file" />
    <input type="submit" name="submit" value="submit" />
</form>

in the python source:

def addimg(req):
    field = util.FieldStorage(req,1,1)
    req.write(dir(field).__str__())
    req.write(repr(field.list))
    for f in field.list:
        req.write(str(f))
    return

the apache config:
<VirtualHost *:8088>
    ServerAdmin webmaster at yey_python.com
    DocumentRoot "h:/webroot/yey_python"
    ServerName www.yey_python.edu
    ErrorLog logs/dummy-host.example.com-error_log
    CustomLog logs/dummy-host.example.com-access_log common
    AddDefaultCharset gb2312
</VirtualHost>
<Directory "H:/webroot/yey_python/bin">
    SetHandler mod_python
    PythonHandler mod_python.publisher
    PythonAutoReload On
    PythonDebug On
    PythonPath "sys.path+['H:/webroot/yey_python/bin']"

    AllowOverride None
    Order allow,deny
    Allow from all
    DefaultType text/html
</Directory>


PS:I'm chinese, and sory for you with my poor English.

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡hoxide
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡hoxide_dirac at yahoo.com.cn
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡2004-08-12



More information about the Mod_python mailing list