Pushing file name to browser

A.M. Kuchling amk at amk.ca
Sun Mar 7 11:25:47 EST 2004


On Sun, 7 Mar 2004 04:48:47 +0100 (CET), 
> info = { "filename": "apa.txt", "fileid": "10001" }
> the_url = '<a href="download.py/%(filename)s?id=%(fileid)s">%(filename)s</a>'%info

Another approach is to include a Content-Disposition header in the 
response that suggests a filename, something like this:

Content-Disposition: inline; filename="paid-for-download.zip"

Most browsers will then suggest paid-for-download.zip as the filename, no
matter what form the download URL takes.  See RFC2183 for the details of
this header.

--amk




More information about the Python-list mailing list