affordit Posted March 4, 2011 Share Posted March 4, 2011 Hello all I have a script that unzips .gz file but after they are unzipped I can not work with them. I unzip the file and then upload to database. BUT when I upload all I get is record IDs, no actual records. When I download the file and open it all the records are there. Can someone tell me what I am doing wrong? Here is the script. <?php $files = glob('./gz/*.gz'); foreach ($files as $in_file) { $file_name=(str_replace(".gz", " ", $in_file)); $fp = gzopen($in_file, "r"); $outFile = fopen($file_name,"wb"); while (!gzeof($fp)) { // read/write only up to 10kb per step $content = gzread($fp, "10240"); // write the data (if any) if ($content !== false){ fwrite($outFile,$content,"10240"); } } } fclose($outFile); ?> Thanks All Link to comment https://forums.phpfreaks.com/topic/229551-problem-unzipping-files/ Share on other sites More sharing options...
dreamwest Posted March 4, 2011 Share Posted March 4, 2011 exec("gunzip file.gz"); Link to comment https://forums.phpfreaks.com/topic/229551-problem-unzipping-files/#findComment-1182681 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.