note 91462 added to function.gzread

From: Date: Thu, 11 Jun 2009 04:21:33 +0000
Subject: note 91462 added to function.gzread
Groups: php.notes 
Request: Send a blank email to php-notes+get-156763@lists.php.net to get a copy of this message
<?php //Extracting the content of a gzip file in php and creating a new csv file using the content //Create a folder uploads inside current folder $local_file = 'test.gz'; //To Get the size of the uncompressed file $FileRead = $local_file; $FileOpen = fopen($FileRead, "rb"); fseek($FileOpen, -4, SEEK_END); $buf = fread($FileOpen, 4); $GZFileSize = end(unpack("V", $buf)); fclose($FileOpen); //To Get the size of the zip file $fzip_size = $GZFileSize; $filename = $local_file; $ext = pathinfo($filename,PATHINFO_EXTENSION); $file_name = pathinfo($filename,PATHINFO_FILENAME); $file_name = $file_name.".csv"; $zd = gzopen($filename, "rb"); $contents = gzread($zd, $fzip_size); gzclose($zd); $file_name = "uploads/".$file_name; $fp = fopen($file_name, "wb"); fwrite($fp, $contents); //write contents of feed to cache file fclose($fp); if(file_exists($file_name)) { chmod($file_name,0755); unlink($local_file); } ?> ---- Server IP: 59.162.86.8 Probable Submitter: 122.172.113.204 ---- Manual Page -- http://www.php.net/manual/en/function.gzread.php Edit -- https://master.php.net/note/edit/91462 Del: integrated -- https://master.php.net/note/delete/91462/integrated Del: useless -- https://master.php.net/note/delete/91462/useless Del: bad code -- https://master.php.net/note/delete/91462/bad+code Del: spam -- https://master.php.net/note/delete/91462/spam Del: non-english -- https://master.php.net/note/delete/91462/non-english Del: in docs -- https://master.php.net/note/delete/91462/in+docs Del: other reasons-- https://master.php.net/note/delete/91462 Reject -- https://master.php.net/note/reject/91462 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#156763) next »