Download with header() - file corrupted

From: Date: Wed, 02 Mar 2005 10:34:51 +0000
Subject: Download with header() - file corrupted
Groups: php.general 
Request: Send a blank email to php-general+get-209818@lists.php.net to get a copy of this message
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

« previous php.general (#209818) next »