Jump to content

Seek File Without Storing in Memory


Guest

Recommended Posts

This is my code to seek throuhg my files

$fh = fopen($file, "rb");
fseek($fh, $seekat);
while (!feof($fh)) {
  print (fread($fh, filesize($file))); 
}
fclose($fh);

 

That works great but if the file is over 64MB it cannot load due to running out of memory. I cannot change my php.ini or anything so I need to be able to load only parts of it at a time or stream the file from some point through rather than temporary storing the file in memory I need this very badly too any help is greatly appreciated.

Link to comment
https://forums.phpfreaks.com/topic/123095-seek-file-without-storing-in-memory/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.