good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
(wil) Re: File Download from CGI Scriptby wil (Priest) |
on Jun 27, 2002 at 15:18 UTC ( [id://177728]=note: print w/replies, xml ) | Need Help?? |
You can not force a browser to download your file. The Web protocols were designed to identify, via MIME Content-Type headers, what sort of content a data stream has, but not specify exactly what to do with it. Various HTML constructs ware designed to suggest, but not to force.
The only thing you can do is send an application/octet-stream; and hope that their browser will interpret this as a file for download. Many people configure their browsers in many different ways so there is no sure method. After all, the end decision rests with the browser/user - and thank goodnes for that. If you really need to make sure that the file gets downloaded, you can try compressing/archiving the file in some way. Or you can try other methods; mainly a scripting language that might be able to do this for you. You can always encourage the user to make use of browser features to save a file to disk, such as right-clicking in most browsers. Cheers - wil
In Section
Seekers of Perl Wisdom
|
|