Hi,
I've implemented a download script using PHP headers to download PDF files. My script is working fine and downloading the corresponding PDF file also in my localhost but that script is not working in my server.
My code is:
header("Content-Disposition: attachment; filename='dfile.pdf'");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-type: application/pdf;");
readfile("http://www.education.gov.yk.ca/pdf/pdf-test.pdf");
In my server file browser is appearing fine and downloading the file also as dfile.pdf
, but If I try to open the downloaded file then I'm getting an error message of the file has been damaged
. Any of my server settings causing this issue or something else?
Any suggestion to fix this problem is much appreciable.
Note: I think this might be an issue with my server PHP settings, can anybody tell me whether the "readfile" function need any PHP setting to enable in my server?
Thanks in advance, Siva...