Suggesting a filename on a HTTP-request by sending someting in the header of the reply

Thomas Weholt 2002 at weholt.org
Thu Sep 19 18:48:15 EDT 2002


I got a simple webserver serving files, but the files are found using
lookup based on ids ( like http://localhost/dl?id=10, where 10 is a key in a
dictionary pointing to a file ), not their filename so when I send
content-type = 'application/octet-stream' in the headers to the client I get
the proper "Save as ..."-dialog, but the filename is all screwed up. It seem
to be the "dl"-part of the url above. I've tried to read the RFC
2616-document and sent "Content-Disposition"-headers etc. but with no luck.

What headers do I need to send for it to get the proper filename in the
"Save as ..."-dialog? Say for instance that the filename I wanted the client
to save the file as was "test.zip".

Any hints?

Best regards,
Thomas





More information about the Python-list mailing list