Downloading a PDF sile from server
Posted: Mon Oct 29, 2007 10:38 am
feyd | Please use
NEED HELP!! PLEASE!!
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
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:Code: Select all
//$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!!
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]