From Ziparchive want name and size of files in Zip file. Problem for me is how can add name and size to table in blade view.
controller:
$ziparchive = new \ZipArchive();
$ziparchive->open($fileName);
$filenames = [];
$filesizes = [];
if(!empty($ziparchive)){
for( $i = 0; $i < $ziparchive->numFiles; $i++ ){
$stat = $ziparchive->statIndex( $i );
$filenames[]= basename( $stat['name'] ) . PHP_EOL;
$filesizes[]= basename( $stat['size'] );
return view('view',["filenames"=>$filenames,"filesizes"=>$filesizes]);
dd($filenames, $filesizes) return two arrays:
1.png
2.png
3.png
4.png
10
12
13
796
in view.blade.php
@foreach($filenames as $filename )
@foreach($filesizes as $filesize)
<tr>
<td>{{$filename}}</td>
<td>{{$filesize}}</td>
</tr>
@endforeach
@endforeach
return in table this:
1.png 10
1.png 12
1.png 13
1.png 796
2.png 10
2.png 12
2.png 13
....
what do i missing ?