Force the browser to show the Save File dialog box
This is much needed when you want to force the web browser to show the Save File dialog box. Generally the web browser opens the file which can be read by it.
It all depends on the header which is being sent from the web server to the client browser. By default, the browser can open the images i.e. .gif, j.pg, .png & some other file as well like .swf (for FF especially).
This is how it can be implemented with Content-disposition. For example I want to force to save the .swf file.
The PHP code will be:
<?phpheader('Content-disposition: attachment; filename=filename.swf');header('Content-type:application/x-shockwave-flash');readfile('pathoffile/filename.swf');exit;?>
Related Posts
- How To Download And Save Youtube Videos
- Browser War : Firefox 2 Vs. IE 7
- System.out.print in PHP
- Firefox : Recommended Extensions
- Emails not getting sent from WordPress blog [Solved]
View Comments to “Force the browser to show the Save File dialog box”
Leave a Reply
Useful post…
Here is the .Net way of doing it: http://forums.asp.net/p/936625/1110987.aspx