|Join Nairaland / LOGIN! / Trending / Recent / New|
Stats: 2,798,074 members, 6,685,725 topics. Date: Friday, 21 January 2022 at 03:24 PM
|Facing Header Problem by Nobody: 12:18am On Mar 29, 2013|
I'm creating a website that creates a zip file and forces user to download of the created file.
I'm having trouble using the header to read the file correctly.
Below is my code:
(Toggle Plain Text)
$zipLocation = "./filesFolder/$pageName.zip";
$flag = ZipArchive::OVERWRITE;
$flag = ZipArchive::CREATE;
$zip = new ZipArchive();
$zip = null;
header("Content-disposition: attachment; filename=$pageName.zip"
The zipfile gets created correctly but when the download dialog appears, the file size is wrong, and when it downloads it cannot be opened.
If I use the commented line it works correctly, but I would rather do it this way using the readfile.
Can any one tell the reason behind it?
|Re: Facing Header Problem by Nobody: 10:33am On Apr 04, 2013|
Set all headers before using print
Once you use print/echo/print_r etc. any header set thereafter is a joke
|Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health |
religion celebs tv-movies music-radio literature webmasters programming techmarket
Nairaland - Copyright © 2005 - 2022 Oluwaseun Osewa. All rights reserved. See How To Advertise. 27