Re: Download with header() - file corrupted

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

 



I solved the problem with inserting this line at the beginning:
ob_end_clean();

all works fine..

I am using php 4 with IIS6 / WinServer 2003

thanks


Werner Jäger wrote:
I try to download a file wit follow code:

   $len = filesize($file);
   $filename = basename($file);
   header("Pragma: public");
   header("Expires: 0");
   header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
   header("Cache-Control: public");
   header("Content-Description: File Transfer");
   header("Content-Type: $ctype");
   $header="Content-Disposition: attachment; filename=".$filename.";";
   header($header );
   header("Content-Transfer-Encoding: binary");
   header("Content-Length: ".$len);
   readfile($file);
   exit;


All works pretty well, the filename is correct, the Content Type and the file size.
When I try to open the downloaded file I see nothing.
The source file on the web server works great.


I played with Content-Transfer-Encoding and tried all values from the RFC

Any ideas?

thank you

-- 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