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

symfony - InvalidConfigurationException in SecurityExtension.php line 429: No authentication listener registered for firewall "secured_area" -

angular ui router - 10 digest iterations reached in angularjs when using $state.go -

javascript - Handling constructor related functions while testing with mocha and sinon -