Hi ,
I have this zip file which has multiple comma separated text files in it. I want to read all the data from all of these files in php without extracting them. But I am kind of struggling with it. Posting my code as below:
//code to open and read the zip file
$zip = zip_open($file_name);
if ($zip) {
while ($zip_entry = zip_read($zip)) {
zip_entry_name($zip_entry) ;
zip_entry_filesize($zip_entry) ;
if (zip_entry_open($zip, $zip_entry, "r")) {
$buf = zip_entry_read($zip_entry, zip_entry_filesize($zip_entry));
//above code just reads data in each file but have to modify this
//and read in some sort of array so that I can have data from each file
zip_entry_close($zip_entry);
}
}
zip_close($zip);
}
if ( strlen($buf)==0)
{
$message = "<result><status>ERROR</status><message>Problem in reading or uploading </message></result>";
}
else{
$message = "<result><status>OK</status><message>$buf: uploaded and read successfully.</message></result>";
}
echo $message;
echo $message;
?>
Any comment or suggestion would be welcome!