How To Force File Download With PHP



Here is a a simple code that will force the browser to download a file

 <?php
$file = "www.mysite.com/myfile.gif";
header("Content-type: application/octet-stream");
header('Content-Disposition: attachment; filename="'.$filename.'";');
download($file);
exit;
?>

Very simple … Don’t forget to subscribe for more tutorials

You can follow any responses to this entry through the RSS 2.0 feed. Both comments and pings are currently closed.

Comments are closed.

 

© 2006 - 2009 BNCScripts.com . All right reserved.