php header question

VonZipper

New Member
I'm trying to mask my download links using the code below.It is almost working - it seems to get the file correctly however when it downloads the file is only 4kB in size.Can anyone offer any suggestions??Thanks!Also please let me know if you need any additional details - I'm running this on MAMP using FF3.5.13\[code\]<?php $filename="download.zip"; $folder = 'downloads'; $abs_path = $_SERVER['DOCUMENT_ROOT']; $path = $abs_path . "/" . $folder ."/" .$filename; // the location of the file. $mm_type="application/zip"; //this is for .zip files - Change this for other file types. header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Cache-Control: public"); header("Content-Description: File Transfer"); header("Content-Type: " . $mm_type); header('Content-Disposition: attachment; filename="'.basename($path).'"'); header("Content-Length: " . filesize($path)); // **code edited as per comments below** header("Content-Transfer-Encoding: binary"); readfile($path); //Output file for download. exit();?>\[/code\]UPDATE: here is what is inside the file generated
Warning: filesize() [function.filesize]: stat failed for /Applications/MAMP/htdocs/downloads/download.zip in /Applications/MAMP/htdocs/CURRENT/test.php on line 15

Warning: Cannot modify header information - headers already sent by (output started at /Applications/MAMP/htdocs/CURRENT/test.php:15) in /Applications/MAMP/htdocs/CURRENT/test.php on line 15

Warning: Cannot modify header information - headers already sent by (output started at /Applications/MAMP/htdocs/CURRENT/test.php:15) in /Applications/MAMP/htdocs/CURRENT/test.php on line 16

Warning: readfile(/Applications/MAMP/htdocs/downloads/download.zip) [function.readfile]: failed to open stream: No such file or directory in /Applications/MAMP/htdocs/CURRENT/test.php on line 17
 
Back
Top