Hitlar
1
My php code is
<?
// Type MIME
$type = "application/pdf";
$visibleName = "fighter.pdf";
$completePath = "http://www.webweb.infinityfreeapp.com/lichi/fighter.pdf";
// Force download
header("Content-disposition: attachment; filename=$visibleName");
header("Content-Type: application/force-download");
header("Content-Transfer-Encoding: $type\n");
header("Content-Length: ".filesize($completePath));
header("Pragma: no-cache");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0, public");
header("Expires: 0");
readfile($completePath);
die();
?>
why this file return a html file instead of pdf content data
<html><body><script>document.cookie="_test=3615ff5e48bd398a38d2ce932bef0629 ; expires=Thu, 31-Dec-37 23:55:55 GMT; path=/" ;document.location.href="http://www.webweb.infinityfreeapp.com/lichi/download.php?path=fighter.pdf&i=1";</script></body></html>
Plz help me
YT_Xaos
2
I believe this is the answer to your question.
6 Likes
Hitlar
3
Not only pdf file for all type of download file either image
Could you provide a link for me to test it? I’m not sure why you decided to use PHP to download the file but I’ll go with it.
3 Likes
Hitlar
5
Sir i just comment this header work fine
header("Content-Length: ".filesize($completePath));
Hitlar
6
Thank you for quick response but why sir Content-Length header return error
Either because…
A. You used it incorrectly
B. Ours system is somehow preventing it from working right’
If it works, leave it, and don’t question it.
7 Likes
Oxy
8
@Hitlar
wonderful - visit this link
Summary
more details regarding the link above

4 Likes
system
Closed
9
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.