Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- php download problem.
August 30, 2005, 6:56 pm
rate this thread
$p = explode('.', $file);
$pc = count($p);
if(($pc > 1) AND isset($mimetype[$p[$pc - 1]]))
//display file inside browser
header("Content-type: " . $mimetype[$p[$pc - 1]] . "\n");
//force download dialog
header("Content-length: " . filesize($path) . "\r\n");
Download dialogue pops just fine and the file gets saved. However,
without fail, the file is 2 bytes larger than the source file. I'm
stumped. Any ideas?
Re: php download problem.
Leading or trailing space in the PHP file?
Have you put the resulting file through a hex editor to find what those two
bytes are? (I think it's a good bet they're \r\n)
You also don't need to put \r\n in calls to header() - this may even be
Andy Hassall :: firstname.lastname@example.org :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool