[b]Force Downloading[/b]
Posted: Mon Nov 01, 2004 8:43 am
The following PHP Codes mentioned below (used to download a file) work only if the file to download is in the same folder as that of the php file. How do you make it work if the file to download is not in the same folder as that of the php file?
function ForceFileDownload($file,$strCoachId)
{
$filesize = @filesize($file);
header("Content-Type: application/octet-stream");
header("Content-Type: application/force-download");
header("Content-Type: application/download");
header("Content-Transfer-Encoding: binary");
header("Content-Disposition: attachment; filename= " .$file. ";");
header("Pragma:no-cache");
header("Expires:0");
//@set_time_limit(600);
readfile($file);
}
function ForceFileDownload($file,$strCoachId)
{
$filesize = @filesize($file);
header("Content-Type: application/octet-stream");
header("Content-Type: application/force-download");
header("Content-Type: application/download");
header("Content-Transfer-Encoding: binary");
header("Content-Disposition: attachment; filename= " .$file. ";");
header("Pragma:no-cache");
header("Expires:0");
//@set_time_limit(600);
readfile($file);
}