Hi there,
I got the answer or the codes in my posted Downloading PDF files, but i have a problem with it. Can you help me regarding this thing, this is my problem, when i'm going to open the downloaded file, the popup menu say that the file is corrupted, what was wrong in my code?
here are the codes:
$fullpath = $filename
if ($fd = fopen ($fullPath, "r"))
{
$fsize = filesize($fullPath);
$path_parts = pathinfo($fullPath);
header("Content-type: application/pdf");
header("Content-Disposition: attachment; filename=\"".$path_parts["basename"]."\"");
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private",false);
header("Content-length: $fsize");
header("Content-Transfer-Encoding: binary");
if (is_readable($filename)==true)
{
while(!feof($fd))
{
$buffer = fread($fd, 2048);
echo $buffer;
}
}
}
fclose ($fd);
exit;
Thanks in advance...
Enter your message below
Sign in or Join us (it's free).