Re: IE problem downloading files

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"Luis Lebron" <llebron@xxxxxxxxxxxxx> wrote on 04/01/2005 09:42:32 AM:

> 
> I have just changed the server that was being used our public website.
> In the process the php scripts used to download files stopped working
> with IE. The new box is running Debian Testing. The php version is
> listed as PHP Version 4.3.10-9. Apache 1.0.33. The download script looks
> like this:
> 
> 
> if(file_exists($path))
> {
>   $filesize = filesize($path);
>   Header("Content-Length: $filesize");
>   Header("Content-type: application/download");
>   Header("Content-Disposition-type: attachment");
>   Header("Content-Disposition: filename=$filename");
>   Header("Content-Transfer-Encoding: binary");
>   $fp = fopen("$path","rb");
>   $result = fpassthru($fp);
>   unlink($path);
>   exit;
> }
> else
> {
>    print "Could not create backup file";
> }

I am not exactly sure what the goal is here, so I don't have an exact 
solution. However, below are some links and code that helped us solve an 
"IE and pdf download" problem.

Good luck!

Kirk

Straight from somewhere in the horse's anatomy:

http://support.microsoft.com/default.aspx?scid=kb;EN-US;q293792

In short - ie will send 2-3 requests to the server per document, most 
servers/code are not prepared for what ie is sending.

Some general info and a way to trick IE:

http://us2.php.net/manual/en/function.session-cache-limiter.php
http://pgsql.designmagick.com/include/fpdf/FAQ.htm#5

Some working code to download a pdf and open it in an acrobat window:

<?
session_cache_limiter('none');
session_start();

// generate the file. . .

// now send it
header('Content-Length: ' . strlen($pdfFileData));
header('Content-Disposition: inline; filename="' . $pdfFileName . '"');
header('Content-Type: application/pdf');
echo $pdfFileData;
?>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux