> I may have discovered the problem. The page in which the link to the
download script resides is SSL-encrypted. So perhaps the download is going over an encrypted connection or something. I discovered this by putting the link to the download script in page that is not SSL-encrypted. The download works fine from regular page. But this raises another question - how to
download over an SSL connection?
Correction... with further testing, the issue clearly has something to do
with the download script.
Here is a non-SSL-encrypted page from which the download is initiated:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01
Transitional//EN"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'>
<link href='../../style.css' rel='stylesheet' type='text/css'>
<title>test</title>
</head>
<?php
echo "
<body>
<div id='bodyContent' style='height:800px'>
<table border='0' cellpadding='0' cellspacing='0' width='760'>
<tr>
<td><img src='../../images/headerbar/headerbar1.jpg</td>
<td><img src='../../images/headerbar/headerbar2.jpg'</td>
</tr>
</table>
<!-- <a href='mydirectory/myfile.zip'>myfile.zip</a> -->
<a href='dlcounter.php?file=myfile.zip'>myfile.zip</a>
</div>
</body>
</html>
";
?>
If I swap the commented line with the uncommented line, it works fine. The
way it is now, I get a corrupted download.
The three operative lines in the download script are:
header("Content-Type: application/octet-stream")
header("Content-Disposition: attachment; filename=".$filename);
readfile($fullpath);
Could the issue be the HTTP variable ?file=myfile.zip?
Perhaps the variables I'm using in the download script?
Some aberrant headers somewhere?
0 thoughts to “Fpassthru download jpg”