Forums
Gents;
I was asked how to bypass the default "just show" the contents for .DOC and .PDF file and prompt the user for download this file.
the trick is to create an file attachment in the content head. A small IceBreak demo that save a small demo.txt file looks like:
<% /free SetContentType ('text/plain'); SetCacheTimeOut(240); SetHeader ('content-disposition' : 'attachment; filename=demo.txt'); *inlr = *ON; %>This is a text in the downloaded file demo.txt
Note: The SetCacheTimeOut(240) is required for IE since it saves data directly from the cache
Have fun :-)
Niels Liisberg
Re: Force download
I have been trying this force download - but don't seem to be able to get it to work. I must be doing something wrong.
The code I am using is exactly as shown using a demo.txt file containing some text.
Problems -
1. Downloaded file is always empty - on saving the download, a file is created on the PC bu zero bytes are transferred.
2. The file name (in this case demo.txt) is replaced with the program name if one specifies a different path for the document (eg. "/bjcs/jobs/demo.txt").
How do I get round these problems?
Regards
Syd