note 10783 added to fopen
| From: | defdac at hotmail dot com | Date: | Mon, 22 Jan 2001 06:41:43 +0000 |
| Subject: | note 10783 added to fopen | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-10060@lists.php.net to get a copy of this message | ||
Newbie advice: The little "b" for binary operations is very essential when working with
PHP4 and Apache on the win32 platform. fread() only reads a couple of hundred bytes when reading for
example an image without "b".
// Read tempfile data into $thumb_img.
$thumb_file_size = filesize('C:\\Temp\\temp.jpg');
$fp = fopen('C:\\Temp\\temp.jpg', "rb");
$thumb_data = addslashes (fread ($fp, $thumb_file_size));
fclose ($fp);
unlink('C:\\Temp\\temp.jpg');
http://www.php.net/manual/en/function.fopen.php