Click to See Complete Forum and Search --> : Download Manager / Save As Dialog Box


danlohye
10-07-2004, 11:41 AM
Hi,

I would like to know how I can force to browser to start a download of a file from my site with the save-as dialog box. This is to ensure PDF, DOC, and music files are not loaded automatically.

Thanks!

Daniel Loh

darkestnight
10-07-2004, 11:51 AM
If you set the MIME type to something else, then the browser plugins will not try to load them when you click them.

JavaHead Jonnie
10-07-2004, 12:05 PM
<?php
$file = '/var/www/html/file-to-download.xyz';
header('Content-Description: File Transfer');
header('Content-Type: application/force-download');
header('Content-Length: ' . filesize($filename));
header('Content-Disposition: attachment; filename=' . basename($file));
readfile($file);
?>