laravel list of file names from the zip archive display in blades

In your method

    $zip_archive = new \ZipArchive(); 
    $zip_archive->open($fileName); 
    $filenames= [];
    if(!empty($zip_archive)){
       for($i = 0; $i < $zip_archive->numFiles; $i++ ){ 
            $stat = $zip_archive->statIndex( $i ); 
            // file's name
            $filenames[] = "{construct it}"; 
      }
    }
    return view('your_view',["filenames"=>$filenames]);

In your view

  @if(count($filenames) > 0) 
     @foreach($filenames as $filename)
       {{$filename}}
     @endforeach
   @endif 

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top