Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

(wil) Re: File Download from CGI Script

by wil (Priest)
on Jun 27, 2002 at 15:18 UTC ( [id://177728]=note: print w/replies, xml ) Need Help??


in reply to File Download from CGI Script

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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://177728]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (3)
As of 2024-04-24 04:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found