Bug #13426 Updated: fread not work
| From: | sander@php.net | Date: | Wed, 17 Oct 2001 10:43:03 +0000 |
| Subject: | Bug #13426 Updated: fread not work | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-68114@lists.php.net to get a copy of this message | ||
ID: 13426
Updated by: sander
Reported By: cquadalti@libero.it
Old Status: Feedback
Status: Closed
Bug Type: Filesystem function related
Operating System: Windows 2000 Professional
PHP Version: 4.0.6
New Comment:
No feedback. Closing.
Previous Comments:
------------------------------------------------------------------------
[2001-09-25 09:58:47] sniper@php.net
So what you're saying is that using fopen with 'rb' which is
the only way to open files (on windows) in binary mode,
does not work? Is this the problem?
Because using 'r' only won't work with binary files, such
as .gif's.
--Jani
------------------------------------------------------------------------
[2001-09-25 06:14:09] cquadalti@libero.it
function encode_file($sourcefile) {
if (is_readable($sourcefile)) {
$fd = fopen($sourcefile, "r");
$contents = fread($fd,filesize($sourcefile));
$encoded = chunk_split(base64_encode($contents));
fclose($fd);
}
return $encoded;
}
$source = $DOCUMENT_ROOT."/IMAGES/titolomail.gif";
encode_file($source);
fopen also don't work with "rb" option and system return a memory violation
error
------------------------------------------------------------------------
[2001-09-25 04:54:16] cquadalti@libero.it
function encode_file($sourcefile) {
if (is_readable($sourcefile)) {
$fd = fopen($sourcefile, "r");
$contents .= fread($fd,filesize($sourcefile));
$encoded = chunk_split(base64_encode($contents));
fclose($fd);
}
return $encoded;
}
$source = $DOCUMENT_ROOT."/IMAGES/titolomail.gif";
encode_file($source);
fopen also don't work with "rb" option and system return a memory violation error
------------------------------------------------------------------------
Edit this bug report at http://bugs.php.net/?id=13426&edit=1