I have the file "manual.pdf" on my server
I want to make it so that when the user clicks a download button it opens a "save as" prompt instead of opening it in internet explorer
I've heard I should add a header() function and change the mime type, but when I did so, it wants to save the php page:
<?
$files = "manual.pdf";
$folder = "/home/vicious/public_html/";
$total = $url . $files;
Header("Content-Type: application/octet-stream");
Header("Content-Length: " . filesize($total));
Header("Content-Disposition: attachment; filename=" . $files);
readfile($total);
?>
Also, the page saved is:
<br />
<b>Warning</b>: filesize(): Stat failed for manual.pdf (errno=2 - No such file or directory) in <b>/home/vicious/public_html/mime.php</b> on line <b>7</b><br />
<br />
<b>Warning</b>: Cannot modify header information - headers already sent by (output started at /home/vicious/public_html/mime.php:7) in <b>/home/vicious/public_html/mime.php</b> on line <b>7</b><br />
<br />
<b>Warning</b>: Cannot modify header information - headers already sent by (output started at /home/vicious/public_html/mime.php:7) in <b>/home/vicious/public_html/mime.php</b> on line <b>8</b><br />
<br />
<b>Warning</b>: readfile(manual.pdf): failed to open stream: No such file or directory in <b>/home/vicious/public_html/mime.php</b> on line <b>9</b><br />