gvp16 Posted February 12, 2010 Share Posted February 12, 2010 Hi, ive got some code that extracts files from a zip file and puts them into a folder, how can i get the filenames of the files being extracted?? heres what ive got : $filename = $_FILES['file']['name']; $source = $_FILES['file']['tmp_name']; $type = $_FILES['file']['type']; $name = explode('.', $filename); $target = $_SESSION["folder"]."/files/images/".$r["name"]; // Ensures that the correct file was chosen $accepted_types = array('application/zip', 'application/x-zip-compressed', 'multipart/x-zip','application/s-compressed'); foreach($accepted_types as $mime_type) { if($mime_type == $type) { $okay = true; break; } } //Safari and Chrome don't register zip mime types. Something better could be used here. $okay = strtolower($name[1]) == 'zip' ? true: false; if(!$okay) { die("Please choose a zip file, dummy!"); } //mkdir($target); $saved_file_location = $target . $filename; if(move_uploaded_file($source, $saved_file_location)) { openZip($saved_file_location); } else { die("There was a problem. Sorry!"); } } } Thanks in advance. Link to comment https://forums.phpfreaks.com/topic/191903-zip-file-help/ Share on other sites More sharing options...
abazoskib Posted February 12, 2010 Share Posted February 12, 2010 scandir() Link to comment https://forums.phpfreaks.com/topic/191903-zip-file-help/#findComment-1011491 Share on other sites More sharing options...
roopurt18 Posted February 12, 2010 Share Posted February 12, 2010 glob() is useful as well. Link to comment https://forums.phpfreaks.com/topic/191903-zip-file-help/#findComment-1011502 Share on other sites More sharing options...
gvp16 Posted February 12, 2010 Author Share Posted February 12, 2010 excellent, thank you very much! Link to comment https://forums.phpfreaks.com/topic/191903-zip-file-help/#findComment-1011521 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.