0

I need to get the images file name in a zip file that uploaded to s3 without download or save, is that possible? Currently i'm only able to make it if file are store in local.

here is my code:

$z = new ZipArchive();
$url = public_path('storage\\' . $asset->getRawOriginal('path'));

$names = [];
if ($z->open($url)) {
    for ($i = 0; $i < $z->numFiles; $i++) {
        $stat = $z->statIndex($i);
        array_push($names, basename($stat['name']));
    }
}
natsort($names);
$names = array_values($names);
return $names;

Is there any method to do so?

N69S
  • 16,110
  • 3
  • 22
  • 36
Blu Ycw
  • 177
  • 1
  • 3
  • 11

1 Answers1

1

To unzip the temporarily saved file you can take a look here

but it seems you must download it first before unzipping, unzip then delete the zip file.

more info here How to extract files from a zip archive in S3

tp45
  • 123
  • 4
  • 13