php - Access files in zip before extracting them -


how can validate files in zip file using finfo_open(fileinfo_mime_type) before extracting them using extractto?

i using ziparchive class: http://php.net/manual/en/class.ziparchive.php

$zip = new ziparchive(); if ($zip->open($_files['upload_file']['tmp_name']) === true) {     ($i = 0; $i < $zip->numfiles; $i++) {         $name=$zip->getnameindex($i);         $pieces=explode(ds,$name);         if(substr($name, -1)==ds) {             //validate directory structure if desired         }         else {             //validate file             $mime=$finfo->buffer($zip->getfromindex($i));         }     } } 

Comments

Popular posts from this blog

html - Firefox flex bug applied to buttons? -

html - Missing border-right in select on Firefox -

c# - two queries in same method -