Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
Thread: HTTP Headers download problem
04-15-2012, 04:13 PM #1
- Join Date
- Mar 2007
- Thanked 2 Times in 2 Posts
HTTP Headers download problem
Hey, I've wrote a script which creates a .pem file, once the form has been submitted I'm trying to send the file using headers, but the file it outputs is a different size to the one that the script creates. The original file works fine, but downloaded one won't open. Here is the code I'm using to download the file.
$filename = urlencode($filename);
$fullpath = realpath("keys/$filename");
$size = filesize("keys/$filename");
header('Cache Control: public');
header("Content-Description: File Transfer");
header("Content-Length:" . $size);
header("Content-Disposition: attachment; filename=" . basename($fullpath));
Thanks for any help.
Last edited by tyanque; 04-15-2012 at 04:51 PM.
04-15-2012, 08:15 PM #2
- Join Date
- Feb 2011
- Your Monitor
- Thanked 506 Times in 493 Posts
From the looks of your code you're using output buffering. Why then are you using ob_clean to clean the buffer - including those headers you've just created?
My helpful sig is on vacation trying to loose some weight. It got a bit fat and caused a few problems but it will be back at some point!