RE: My file upload cgi ...
Why don't you use psupload?
http://www.perlservices.net/en/programs/psupload/index.shtml
It's easy to use and it works perfect both in windows and Linux.
-----Original Message-----
From: Johann Spies [mailto:jspies@sun.ac.za]
Sent: Monday, May 05, 2003 9:07 AM
To: debian-user@lists.debian.org
Subject: My file upload cgi ...
Writing cgi's is new to me.
I am trying to write a cgi to upload a file and after a search on
google found an example written in python by Guido von Rossum.
I thought I would take that as my basis but so far I have had only
frustration.
The form:
-----------------------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html;
charset=iso-8859-1">
</HEAD>
<form action="http://js/cgi-bin/fupload.cgi" method="POST"
enctype="multipart/form-data">
<input type="file" name="filename">
<input type="submit">
</form>
</BODY>
</HTML>
---------------------------
"js" is a VirtualHost on the machine. Suexec is active and other
cgi's (for testing purposes) work correctly.
fupload.cgi looks like this:
--------------------------
#!/usr/bin/python
import cgi
print "Content-type: text/html\r\n\r\n"
form = cgi.FieldStorage()
if not form:
print """
<form action="/cgi-bin/test.py" method="POST"
enctype="multipart/form-data">
<input type="file" name="filename">
<input type="submit">
</form>
"""
elif form.has_key("filename"):
item = form["filename"]
if item.file:
output=open ("/var/www/js/cgi-bin/tmp/%s" % item, 'w')
data = item.file.read() # read contents of file
ouput.write (data)
---------------------------
And the error message in the browser (links):
-----------------
500 Internal
Server Error
Internal Server Error
The server encountered an internal error or misconfiguration and was
unable to complete your request.
Please contact the server administrator, [no address given] and
inform
them of the time the error occurred, and anything you might have done
that
may have caused the error.
More information about this error may be available in the server
error
log.
-------------------------
However there is no entry in /var/log/apache/error_log or access_log
or suexec_log that reflects anything that apache handled at the time
of the upload request.
I have wasted a lot of time on this one and would appreciate some help
please.
Regards.
Johann
--
Johann Spies Telefoon: 021-808 4036
Informasietegnologie, Universiteit van Stellenbosch
"Do not repay anyone evil for evil. Be careful to do
what is right in the eyes of all men."
Romans 12:17
--
To UNSUBSCRIBE, email to debian-user-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact
listmaster@lists.debian.org
Reply to: