PHP Proxy for big files (Relaying) -
i looking php function, gets file web server, while outputting it. big file should output chunk eg 1kb once it's loaded , not load whole file , output it. possible?
from understood question want offer file download doesn't eat ram, large files? if so, possible standard php file reading functions; this:
$chunk_size=1024; $file_name='read.txt'; //open file $file=fopen($file_name,'r'); if($file!=false){ //while haven't reached end while(!feof($file)){ //read chunk , output $line=fread($file,$chunk_size); echo $line; } fclose($file); } else{ //error reading file }
you can wrap in php function if like. should noted literally wrote code stack overflow untested. should give idea on theory.
hope helps, ryan
/** edit **/
p.s code not include code force download - if require this, please let me know. also, should work remote files however, there setting in php.ini file allows or prevents action (allow_url_fopen).
Comments
Post a Comment