Welcome Guest, Not a member yet? Register   Sign In
RE: Zip files, downloading, and IE headers
#1

[eluser]Kinsbane[/eluser]
Hi folks,

On my site I have a tool where people can either browse through Visio stencils of products individually, or they can download a ZIP file containing all the visio stencils + JPG previews for an entire product family.

I just had a user email me that the ZIP file he downloaded is being shown as corrupt and will not open with WinZip, however, it will open with WinRAR.

I've also had reports of people not being able to open PDF files directly from the server (this isn't related, but thought I'd mention in case a solution presented itself).

I was looking through the ZIP library and noticed the download function just calls the force_download() in the download_helper method. On our about line 74 in /system/helpers/download_helper.php is a if/else case for MSIE and setting up specific headers:
Code:
if (strstr($_SERVER['HTTP_USER_AGENT'], "MSIE"))
        {
            header('Content-Type: "'.$mime.'"');
            header('Content-Disposition: attachment; filename="'.$filename.'"');
            header('Expires: 0');
            header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
            header("Content-Transfer-Encoding: binary");
            header('Pragma: public');
            header("Content-Length: ".strlen($data));
        }
else
{
...
}
I was wondering, how accurate are these? I'm afraid that the issues I've seen PDF's and now this zip file is related to IE and the headers needed for proper streaming of a file from the server to IE.

Can anyone offer any explanation / guidance?

Thank you!!




Theme © iAndrew 2016 - Forum software by © MyBB