[Tutor] Sightly off topic - download file name

P

pxlpluker

I what to dynamically create a page that has download links to file
stored on disk.
the part i don't know how to do (or if its possible) is to a different
name appear in the browser DL window.
i.e. I want the files stored with a random string but when being DL to
have real name show in File Save dialog.


Fred
 
I

Irmen de Jong

pxlpluker said:
I what to dynamically create a page that has download links to file
stored on disk.
the part i don't know how to do (or if its possible) is to a different
name appear in the browser DL window.
i.e. I want the files stored with a random string but when being DL to
have real name show in File Save dialog.


Fred

This is not something Python-specific.
Have a look at the "Content-Disposition" HTTP header
(RFC 2183, http://www.faqs.org/rfcs/rfc2183.html)

For example when you add the following HTTP header to your
result message:

Content-Disposition: attachment; filename="foobar.txt"

most browsers will offer a download window for a file named
'foobar.txt'.


--Irmen
 

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

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,016
Latest member
TatianaCha

Latest Threads

Top