php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #13426 fread not work
Submitted: 2001-09-25 04:54 UTC Modified: 2001-10-17 06:43 UTC
From: cquadalti at libero dot it Assigned:
Status: Closed Package: Filesystem function related
PHP Version: 4.0.6 OS: Windows 2000 Professional
Private report: No CVE-ID: None
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
45 - 14 = ?
Subscribe to this entry?

 
 [2001-09-25 04:54 UTC] cquadalti at libero dot 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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-09-25 06:14 UTC] cquadalti at libero dot 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 09:58 UTC] 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-10-17 06:43 UTC] sander@php.net
No feedback. Closing.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Oct 31 22:01:27 2024 UTC