[mod_python] upload file?

Michael C. Neel neel at mediapulse.com
Fri May 7 09:44:08 EST 2004


As stated already, you need to set the enctype of the form, ie

<form METHOD="POST" ACTION="http://mudd.homeip.net/javaSignAuto/jsa.py"
enctype="multipart/form-data">

You seem to be new to HTML and server interaction; A good book on CGI
might help in understanding the basic concepts and then move to
mod_python after you've got a better grasp on what's really happening. 
I don't have a title off the top of my head, but O'Rielly is usally a
good bet.

Mike

On Fri, 2004-05-07 at 08:14, John Mudd wrote:

> I'm still trying to upload a file.
> 
> I reduced my mod_python code to a small example and attached it.  It
> uses HTMLgen to generate the HTML.  I've listed the HTML and the trace
> output below.  The name of the file I'm trying to upload is
> 'zopeIntro.txt'.  I'm using Apache/2.0.49 (Unix) mod_python/3.1.3
> Python/2.3.
> 
> I'm hoping this will make whatever mistake I'm making easier to see. 
> Any suggestions?
> 
> 
> 
> 
> 
> Here's the trace output:
> 
> --------------------------------------------------------------------------------
> item.name='inputJar'
> item=Field('inputJar', 'zopeIntro.txt')
> item.type='text/plain'
> item.type_options={}
> type(item)=<type 'instance'>
> item.value='zopeIntro.txt'
> item.file.read()='zopeIntro.txt'
> item.name='add product'
> inputJar='zopeIntro.txt'
> type(inputJar)=<class 'mod_python.util.StringField'>
> dir(inputJar)=['__add__', '__class__', '__contains__', '__delattr__',
> '__dict__', '__doc__', '__eq__', '__ge__', '__getattribute__',
> '__getitem__', '__getnewargs__', '__getslice__', '__gt__', '__hash__',
> '__init__', '__le__', '__len__', '__lt__', '__mod__', '__module__',
> '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__',
> '__repr__', '__rmod__', '__rmul__', '__setattr__', '__str__',
> 'capitalize', 'center', 'count', 'decode', 'encode', 'endswith',
> 'expandtabs', 'find', 'index', 'isalnum', 'isalpha', 'isdigit',
> 'islower', 'isspace', 'istitle', 'isupper', 'join', 'ljust', 'lower',
> 'lstrip', 'replace', 'rfind', 'rindex', 'rjust', 'rstrip', 'split',
> 'splitlines', 'startswith', 'strip', 'swapcase', 'title', 'translate',
> 'upper', 'value', 'zfill']
> 
> 
> 
> 
> 
> Here's the HTML.
> 
> 
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
> <html>
> 
> <!-- This file generated using Python HTMLgen module. -->
> <head>
>   <meta NAME="GENERATOR" CONTENT="HTMLgen 2.2.2">
>         <title>Products</title>
> </head>
> <body>
> <img src="/image/banner.gif" height="30" width="472" alt="banner.gif" border="0"><br>
> <span style="width: 60px"></span> 
> <img src="../image/blank.gif" height="19" width="71" alt="blank.gif"> 
> <img src="../image/blank.gif" height="19" width="71" alt="blank.gif"> 
> <img src="../image/blank.gif" height="19" width="71" alt="blank.gif"> 
> <h3>Products</h3>
> <hr>
> 
> 
> <form METHOD="POST" ACTION="http://mudd.homeip.net/javaSignAuto/jsa.py">
> 
> <input TYPE="file" NAME="inputJar">
> <input TYPE="submit" NAME="add product" VALUE="Add Product">
> </form>
> 
> 
> <p><hr>
> <span style="width: 60px"></span> 
> <img src="../image/blank.gif" height="19" width="71" alt="blank.gif"> 
> <img src="../image/blank.gif" height="19" width="71" alt="blank.gif"> 
> <img src="../image/blank.gif" height="19" width="71" alt="blank.gif"> 
> <br><img src="/image/logo.gif" height="35" width="36" alt="logo.gif" align="bottom">
> <font SIZE="-1"><p>Copyright &#169 Micky Mouse<br>All Rights Reserved<br>
> 
> Comments to author: <a HREF="mailto:&#109;ic&#107;y@&#100;is&#110;ey&#46;co&#109;">micky at disney.com</a><br>
> Generated: Fri May 7, 2004 <br><hr>
> </font>
> </body> </html>
> 
> 
> ______________________________________________________________________
> 
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python

09:41:20 up 4 days, 18 min, 3 users, load average: 0.07, 0.23, 0.31
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.modpython.org/pipermail/mod_python/attachments/20040507/7deab2bb/attachment.html


More information about the Mod_python mailing list