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 Quote Link to comment Share on other sites More sharing options...
dreamwest Posted March 4, 2011 Share Posted March 4, 2011 exec("gunzip file.gz"); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.