Download

I

Ivo

I want to direct requested downloads myself, so I can add counters, loggers
etc. in it.
After all the logging is done I want to start the requested download. I
tried many different versions of the code below and all I get is broken
downloads...

Does one of you know what I am doing wrong...?
(it is a CGI script)
(...snip...)
fhandle = open(loc, 'r')
file = fhandle.read()
fhandle.close()

print('Content-Type: application/octet-stream; name=%s' % data[1])
#print('Content-type: application/force-download')
print('Content-length: %s' % len(file))
print('Content-Disposition: attachment; filename="%s"' % data[1])
print
print file
#sys.stdout.write(file)
(...snip...)

--
Cheerz,

Ivo.
http://IvoNet.nl
"Life is like a nose.. You have to get out of it what's in it!"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,077
Latest member
SangMoor21

Latest Threads

Top