with only 'r' mode fread() doesn't work: instead of 3kbyte for my image, are sent 60 byte. But if I use 'rb' mode browser give me a memory error. So, also fopen() doesn't work correctly. the error tell that the memory couldn't be 'read' and give me a memory address.. it may be an Apache error, i don't know! I use apache 1.3.20 and php 4.0.6 with module for apache. Thanks Cesare Quadalti ----- Original Message ----- From: "Bug Database" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, September 25, 2001 3:58 PM Subject: Bug #13426 Updated: fread not work > ID: 13426 > Updated by: sniper > Reported By: [EMAIL PROTECTED] > Old Status: Open > Status: Feedback > Bug Type: Filesystem function related > Operating System: Windows 2000 Professional > PHP Version: 4.0.6 > New Comment: > > 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 > > > > > Previous Comments: > ------------------------------------------------------------------------ > > [2001-09-25 06:14:09] [EMAIL PROTECTED] > > 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] [EMAIL PROTECTED] > > 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 > > ------------------------------------------------------------------------ > > > > ATTENTION! Do NOT reply to this email! > To reply, use the web interface found at http://bugs.php.net/?id=13426&edit=2 > > -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]