Download

Ivo Spam at ivonet.nl
Sat Mar 6 10:56:57 EST 2004


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!"





More information about the Python-list mailing list