Why does reading from a php://memory wrapper I've just written to fail? -
i'm trying read php://memory
wrapper using fread()
fread()
returns false. code simplified:
$file_handle = fopen('php://memory', 'w+'); // have tried php:temp also. fwrite($file_handle, 'contents'); $file = fread($file_handle, filesize($file_handle)); // have tried 99999 filesize.
$file
false after fread()
.
what's going on?
thanks in advance!
you'll need rewind($file_handle) after writing before can read you've written, because writing moves file pointer end of file
Comments
Post a Comment