Return to Snippet

Revision: 9549
at November 11, 2008 13:29 by irishsk


Initial Code
header("Content-type: application/octet-stream");
 
// displays progress bar when downloading (credits to Felix ;-))
header("Content-Length: " . filesize('myImage.jpg'));
 
// file name of download file
header('Content-Disposition: attachment; filename="myImage.jpg"');
 
// reads the file on the server
readfile('myImage.jpg');

Initial URL


Initial Description


Initial Title
Force Download of File

Initial Tags


Initial Language
PHP