I want to save a downloading file with his own name and the jpg extension
but my code below is getting a file with the php filename (download.php)
if a rename download.php to download.jpg i can see the picture..
what changes must be made to download the jpg file with the jpg extension? and his filename?
<?
$file = getParam("file");
$download_dir = getParam("download_dir");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache"); // HTTP/1.0
header("Content-Type: application/force-download");
header("Content- Transfer-Encoding: binary");
Header('Content-Type: application/jpeg');
if( $download_dir == "pictures" ) {
Header("Content-Disposition: filename=".substr($file, 9) );
}
else {
Header("Content-Disposition: filename=".substr($file, 8) );
}
readfile("$file");
?>