26 Jun
2006
26 Jun
'06
6:55 p.m.
Bruno Grampa wrote at 2006-6-26 12:46 +0200:
i want to send an image or a pdf to a browser not for viewing but for downloading. I've written this code: <dtml-call "RESPONSE.setHeader('Content-type', 'application/force-download')"> <dtml-call "RESPONSE.setHeader('Content-Disposition', 'attachment; filename=filename.gif')">
You add an additional '<dtml-var "index_html(REQUEST, RESPONSE)">' It might be necessary to avoid white space around your tags. Therefore, it is better to do this in a Python Script rather than a DTML object. There, it would look like: r = container.REQUEST; R = r.RESPONSE R.setHeader(...) # your additional headers ... return context.index_html(r, R) -- Dieter