note 34319 deleted from function.fread by sp

From: Date: Wed, 23 Jul 2003 21:59:36 +0000
Subject: note 34319 deleted from function.fread by sp
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-52524@lists.php.net to get a copy of this message
Note Submitter: ---- readfile() cause a lot of problem with IE when trying to 'open' a file while download the file using the header() scripts. I'm using IIS and IE where this problem occur. Instead, the alternative is to use the fopen(), fread(), fclose() and spit out the result. This solve the problem with opening the file while downloading. --snip-- $file="test.exe"; header ("Pragma: public"); header ("Expires: 0"); // set expiration time header ("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header ("Content-Type: application/force-download"); header ("Content-Type: application/octet-stream"); header ("Content-Type: application/download"); header ("Content-Disposition: attachment; filename=test_different_name.exe;"); header ("Content-Length: ".filesize($file)); header ("Content-Transfer-Encoding: binary"); //readfile($file); //$content = fread ($fp, filesize($file)); //fclose ($fp); //print $content; $fp = fopen($file, 'rb'); $content = fread ($fp, filesize($file)); fclose ($fp); print $content; exit(); --snip--

« previous php.notes (#52524) next »