Weirfire
Sep 19th 2006, 7:18 am
I have a piece of code which allows people to download a file when they click a link even if it is an image file.
However when they go to download it, it always asks the user to save it as "download.[tag]" instead of saving it as the filename it already has. If anyone knows how to sort this so that it saves it with the existing filename please let me know.
//Begin writing headers
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: public");
header("Content-Description: File Transfer");
header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment; filename=".$filename);
header("Content-Transfer-Encoding: binary");
header("Content-Length: ".filesize($base_file . $script_file . $filename));
However when they go to download it, it always asks the user to save it as "download.[tag]" instead of saving it as the filename it already has. If anyone knows how to sort this so that it saves it with the existing filename please let me know.
//Begin writing headers
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: public");
header("Content-Description: File Transfer");
header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment; filename=".$filename);
header("Content-Transfer-Encoding: binary");
header("Content-Length: ".filesize($base_file . $script_file . $filename));