|
Brian Akey
bakey at traq.com
Wed Mar 20 10:52:29 EST 2002
I have a cgi python script that does upload. It should be easy to convert.
#!/usr/bin/python
import cgi
form = cgi.FieldStorage()
print 'Content-type: text/html'
print
if not form:
print """
<html><head><title>File Upload</title></head><body>
<form action"/cgi-bin/file.py" method="POST"
enctype="multipart/form-data">
<input type="file" name="filename">
<input type="submit" name="Send_File" value="Send_File">
</form>
<p>Please compress the file(s) with Winzip or some other compression
tool before sending the file.
</body></html>
"""
elif form.has_key("filename"):
item = form["filename"]
if item.file:
data = item.file.read()
filen = item.filename
filen1 = filen.split('\\')
filen2 = filen1[len(filen1)-1]
#filen2 = 'd.txt'
open('/www/download/' + filen2 + '.tmp','wb').write(data)
print """
<html><head><title>File Upload</title></head><body>
Thank you for the file
"""
print cgi.escape(filen2)
print '</body></html>'
-----Original Message-----
From: Bob Ippolito [mailto:bob at redivi.com]
Sent: Wednesday, March 20, 2002 10:18 AM
To: mod_python at modpython.org
Subject: [mod_python] File upload progress indicator
I'm developing an application using mod_python and I'd like to include
file upload progress indication.. However, I don't see any obvious way
on how do to such a thing.
|