I wish when the user clicks on a link say.
http://www.xyz.com/dynamic-text.py
The browser will prompt user to save the text file.
The following script will make browser to prompt user to save dynamic-text.py. I wish to prompt user to save some-file-name.txt. How can I do so?
dynamic-text.py
#!c:/Python27/python.exe -u
print "Content-type: text/text"
print
print "This is Text File"
You can send the Content-Disposition HTTP header:
Also note that you should use the
text/plaincontent type instead oftext/textwhich, to my knowledge, doesn’t exist.