Jump to content

Scan Zip File


The Little Guy

Recommended Posts

Is it possible to scan through a zip file on upload, and retrieve all the files that are contained with in that zip file? I would like to save all contents of the zip file to a database, such as...

files, folders, and sub files and sub folders.

That way people who download the zip file will be able to tell what is inside the file before they download it.
Link to comment
https://forums.phpfreaks.com/topic/28144-scan-zip-file/
Share on other sites

I got it... and here is how I did it if anyone wants to know:

zip must be enabled on your server.
[code]<?php
$zip = zip_open($_FILES['origial_file']['tmp_name']);

if ($zip) {
  while ($zip_entry = zip_read($zip)) {
  echo "<b>Name:</b>              " . zip_entry_name($zip_entry) . "\n<br>";

  }

  zip_close($zip);

}
?>[/code]
Link to comment
https://forums.phpfreaks.com/topic/28144-scan-zip-file/#findComment-128739
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.