Hey all,
Im trying to download and open (an existing pdf file on the server) on the user's pc and I have this code but it is not
WORKING!! I read a lot and nothing working
Im using PHP5 and apache
here is the code:
//$file is the path of the file on the server
//$filename is the file name
//$filesize is size
$filename=substr($file,20);
$filesize=filesize($file);
header("Content-Disposition: attachment; filename=".$filename);
header("Content-type: application/pdf");
header("Content-Length: ".$filesize);
$data = file_get_contents($file);
echo $data;
NEED HELP!! PLEASE!!
Downloading a PDF sile from server
Moderator: General Moderators