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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: cquadalti at libero dot it
New email:
PHP Version: OS:

 

 [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 23:01:28 2024 UTC