Gettin this error when im trying to download zip file
The file "C:\wamp\www\Petro\public\download/downloads.zip" does not exist
My code
if (\File::exists('download/downloads.zip')) {
$directory = public_path('download');
$success = \File::cleanDirectory($directory);
foreach($checked as $check){
$path = File::where('name',$check)->select('real_path')->first();
$img = \Image::make($path->real_path);
$img->save(public_path('download'). '/'. $check);
}
} else {
foreach($checked as $check){
$path = File::where('name',$check)->select('real_path')->first();
$img = \Image::make($path->real_path);
$img->save(public_path('download'). '/'. $check);
}
}
$files = \File::files('download');
\Zipper::make('download/downloads.zip')->add($files);
$pathtoFile = public_path('download/downloads.zip');
return response()->download($pathtoFile);
The zip is created but i cant download it, what is wrong with my code?
When i use dd($files)
after create the zip :
array:4 [▼
0 => "download/batman.jpg"
1 => "download/batmanfamily.jpg"
2 => "download/batwoman.jpg"
3 => "download/daredevil.jpg"
]
There is not zip file but if i check in my local directory the zip is created. Can you guys give me a hand with this and sorry for the bad english.