sanjeev c s wrote:
hello, in my webpage,i want user to download a zip file. this is the code
<a href="folder1/<dtml-var e_name>"><dtml-var iname> </a>
variable e_name contains the zip file with a id and a title. now when i click on iname it opens the download dialogue box. i say save to disk. now id of the variable e_name becomes the default file name(in the save as box). can i make the title of e_name as a default name (in the save as box)?? how ?? Please help.
This is not straightforward for a file, and esp. not a zope thing/problem. By default, the browser uses the tail of a URI to construct the filename for saving. Additionally, most browser honor a http-header which looks like Content-Disposition: attachment; filename="filename.ext" which would cause the "save as" box to display "filename.ext" as filename. Now we need to get zope to return this header for an object of type file. Fortunately, a file has a property called "precondition". We use that to call a python script to set the right header. So put the following line in a python script above your files in the hierachy: context.REQUEST.RESPONSE.setHeader('Content-Disposition','attachment; filename=' + context.title) call it "setheader" and use setheader as precondition for your files. cheers, oliver