mysql - extracting a zip file and accessing each content of the zip file and then move it to a new location in php -


i trying build application have upload zip file , extract contents , put them mysql database.i halfway successful in doing so..that uploaded zip file temporary folder named uploads....now want accessing each individual content , put in formation database , move real content original upload folder real_uploads....i trying iam not able figure out how proceed.... following below code........

<?php if(isset($_files['zip'])){     //defined error erray     $errors=array();     $zip = new ziparchive();     //print_r($_files['zip']);     //taking extention of last file (in lower case) of zip file     if(strtolower(end(explode('.',$_files['zip']['name'])))!=='zip'){         $errors[]="this not zip file";         //echo "file not opened";     }     //if file bigger 100mb     if($_files['zip']['size']>104857600){         $errors[]="there size limit of 100 mb";     }     if($zip->open($_files['zip']['tmp_name'])===false){         echo "file opened";         $errors[]="failed open zip file";     }     if(empty($errors)){          $path=$zip->extractto('uploads');         print_r($zip);         $extracted_files=array();          for($i=0;$i<$zip->numfiles;++$i){             $zip_name=$zip->statindex($i);             $extracted_files[]=basename($zip_name['name']);          $zip->close();     } }   ?> <html>     <body>         <form action="" method="post" enctype="multipart/form-data">             <div>                 <input type="file" name="zip"/>                 <input type="submit" value="upload"/>             </div>         </form>     </body> </html> <?php if(isset($errors)){     if(empty($errors)){         echo 'your files '.implode("<br> ",$extracted_files).' been uploaded';          }else{             foreach($errors $error){                 echo '<p>'.$error.'</p>';             }         } } ?> 


Comments

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -