File bug and Mime_Mail extension
| From: | Wolfram Kriesing | Date: | Thu, 16 May 2002 16:22:20 +0000 |
| Subject: | File bug and Mime_Mail extension | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-6152@lists.php.net to get a copy of this message | ||
a problem with "File::readAll( remote file )" on a remote file:
the method File::_getFilePointer checks the following
// Check it exists
if (FILE_MODE_READ == $mode AND !file_exists($filename)) {
return PEAR::raiseError('File does not exists: ' . $filename);
but file_exists doesnt work on remote files, as i need it to extend the Mail_Mime class to work with remote files too.
what i am planning is to use the following in the Mail_Mime class:
File::readAll( $filename )
instead of the current
$fd = fopen( $filename )
fread( $fd , filesize($filename) ); // here filesize doesnt work on remote files
but neither works yet :-(
or - i had once written a pear-compatible file class which simply abstracts all file-functionality and makes it work on remote files as well,
shall this one be commited too?
http://www.kriesing.de/showsource.php?domain=wolfram.kriesing.de&file=/libs/php/File/Common.php
it has the methods:
open( $file, string $mode)
close([ int $fp ])
readLine()
exists( $file)
copy(string $fileFrom, string $fileTo)
getSize( $file)
&readEntireFile(string $file, [ string $mode ])
writeEntireFile(string $filename, string $content)
isRemote(string $file)
writeLine()
and each method works on local and remote files
phpdoc is at
http://wolfram.kriesing.de/libs/php/docs/File_Common.html
--
Wolfram
... translating template engine ....
http://sf.net/projects/simpletpl
... authentication system ....
http://sf.net/projects/auth