Hi Jerry, Jerry wrote:
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.
This is just because application/save is usually not linked to any application. The standard (as of mime) compliant way to specify a not linked mime-type is application/octed-stream. content-disposition helps to specify an intended filename which is often respected by browsers. With File-objects in zope you can for example call a script to modify response-headers as "precondition". HTH Tino Wildenhain