note 14861 added to function.header.php
| From: | papaowl at web dot de | Date: | Fri, 17 Aug 2001 17:01:21 +0000 |
| Subject: | note 14861 added to function.header.php | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-16853@lists.php.net to get a copy of this message | ||
I tried passing through a pic with the following code:
header("Content-Disposition: attachment; filename=$picsfilename");
header("Content-Type: application/octet-stream");
header("Content-Length: ".filesize($picsurl));
header("Content-Transfer-Encoding: binary");
$fp = fopen("$picsurl", "rb");
print fread($fp, filesize($picsurl));
fclose($fp);
the pic downloaded is somehow corrupted with a few more bytes.
I realized that it works with:
$fn=fopen("$picsurl" , "rb");
fpassthru($fn);
instead.
http://www.php.net/manual/en/function.header.php