I have little trouble to show names of files which are contains in ZIP archive in blade.
blade controller
:
$zip_archive = new \ZipArchive();
$zip_archive->open($fileName);
for( $i = 0; $i < $zip_archive->numFiles; $i++ ){
$stat = $zip_archive->statIndex( $i );
print_r( basename( $stat['name'] ) . PHP_EOL );
}
print_r
show in blade
1.png 2.png. 3.png 4.png
is possible to transform this to table ?
something like
@foreach ($ as $)
<td>{{ }}</td>
@endforeach
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