zip - PHP ZipArchive fails to extract CSV files properly -


a real head scratcher 1 - gratefully received.

i have been using ziparchive library extract csv files zip.

oddly, extract 40 files properly. files index 40 or greater appear empty files, files 0-39 extract perfectly.

this case regardless of combination of files , size of files. have tried removing 39th file , 40th file zip , problem moves. no matter combination of files use, extracts 40 files , dies.

thanks forum, have tried using shell exec same outcome. have tried extracting files 1 @ time, using zip csv files , zips multiple different file types. 40 extracted.

this such suspiciously round number must surely setting somewhere cannot find or otherwise bug.

for worth, unzipping code below:

    $zip = new ziparchive;     if ($zip->open('directory/zipname.zip') == true) {      ($i = 0; $i < $zip->numfiles; $i++) {         $filename = $zip->getnameindex($i);          if(substr(strrchr($filename,'.'),1,3)=="csv")         {          $zip->extractto('directory/',$filename);         }         }     } 

i have tried following uses different method same results :-(

$zip2 = new ziparchive; if ($zip2->open('directory/zipname.zip') == true) {  ($i = 0; $i < $zip2->numfiles; $i++) {      $filename = $zip2->getnameindex($i);      if(substr(strrchr($filename,'.'),1,3)=="csv")             {             $content=$zip2->getfromindex($i);             $thefile=fopen("directory/filename","w");             fwrite($thefile,$content);             fclose($thefile);             }    } } 

finally found answer. tried help.

for others suffering in same way, problem solved increasing server disk allocation. on rather old plan had served until advent of new national database increased amount of storage 10 fold. measly 100mb allowance meant server before spitting dummy.

interestingly, similar problem occurred trying other file operations - seemed limited 40 file operations per script, regardless of size of each file.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -