[Zope] auto download link

Jerry lists411 at myd1.com
Fri Feb 13 19:37:25 EST 2004


Hi Dieter,

You <DM> wrote on Friday (2/13/2004 at 11:21) thus about [Zope] auto download link:
DM> Jerry wrote at 2004-2-12 16:04 -0800:
>>I have some python files that I want users to be able to download.  I
>>would like them to be able to click on the anchor and start
>>downloading.  I must be missing something fundamental in Zope or HTML.
>>I cannot figure out how to *download* the file instead of display it.

DM> You must learn about the "Content-Disposition" header
DM> (search the mailing list archive).
DM> Come back when you have more questions.

Blatantly disregarding your closing demand, I come bearing answers. ;)
(Actually, your suggestion was helpful).

After searching several archives I found THE ANSWER (that works for
me(tm)). Either this is a well kept secret of the HTTP/1.1 gurus, or
I'm just an ignorant snake. I set the Content Type of the File in the
ZMI to ...

application/save

and now all the browsers that I've tested will automatically prompt to
save the file with the correct name when one tries to open the URI.

Other non-important details I found and/or learned:

* The values placed into the Content-Type header are not specified in
  the HTTP/1.1 spec, and I couldn't find a definitive list.
* I found the 'application/save' value in the Opera browser forum.
* I tried Content-Disposition, and it worked for all browsers except
  Opera, where it added the .exe after the name I told it to save as.
* Content-Disposition is not in the HTTP/1.1 specifications, but comes
  from e-mail headers and is 'suggested' for browsers to obey.
* searching Google for "application/save" doesn't work (/=white space)
* searching Google for header "content-type" "application/save"
  gets only 14 mentions of application/save, all in PHP forums
* searching Google using http://www.google.com/intl/xx-elmer/ is more
  fun.
* I hope somebody in the future finds this and saves themselves hours
  of searching!
-- 
Jerry      (Mailed safely with The Bat! 2.02.3 CE)
___________________________
Everything comes to him who hustles while he waits. -- Thomas A. Edison





More information about the Zope mailing list