Jump to content
xisto Community

renegade_division

Members
  • Content Count

    1
  • Joined

  • Last visited

  1. First of all don't use file() function instead use fread() functions. I think you should deploy the split-script technique. Its different from splitting your text file. Instead you get two scripts to do the same job. Or you can deploy the following method. First of all you should be knowing the size of the max text file which can be read in the max_execution_time on your Web Server. For that you need to use fread() function. with something like this: $file=fopen("file.txt","r");$count=0;while(!feof($file)){$data=fread($file,1024);print($count+"<br>");flush();//flush it in betweenob_flush();//so that you get the count of max number of 1024 chunkssupported$count++;}Now when the script crashes note down the count number and copy the script where you used the file() function with some other name. For example: //file_proc.phpif(!isset($_GET['startcount'])&&!isset($_GET['startcount'])){$startcount=0;$endcount=$max_count_supported;//the number you took from the lastscript.}$file=fopen("file.txt","r");fseek($file,($endcount-$startcount)*1024);for($count=0;$count<=($endcount-$startcount);$count++){$data=fread($file,1024);//Process the data here}//Redirect the script to file_proc.php?startcount=$endcount&endcount=($endcount+$max_supported_count)I guess this should be getting the work done.
×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | 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.