Python & CGI. HELP please...
Enrico Morelli
enrico_morelli at yahoo.com
Thu Jun 5 05:57:38 EDT 2003
Dear all,
I'm trying to write a script to be able to download/upload files
through web pages.
The upload script works fine but the download no.
When I download a file (pdf for example) using this script, I'm unable
to open it in local using acroread because at the end of the document I
found some html rows :-||
These rows are some html code inside of the script that I use to
display errors.
Follow the method that I use to download files:
def download(self, fullname, file):
print "Content-Type: application/download"
print "Content-Disposition: attachment; filename=%s\n" % file
try:
f=open(fullname, "rb")
l=f.read()
sys.stdout.write(l)
f.close()
sys.exit()
except:
msg="An error occurred during file transfer."
Display(msg, "")
sys.exit()
Can someone help me??
Thanks a lot
Enrico
More information about the Python-list
mailing list