Open Frasaccordi opened 8 years ago
@sadalsuud
Hi, you need chain function ->close() for wait to ready the zip file. In my case: Zipper::make(public_path() . '/quibdo.zip')->add($files)->close(); It work! :D
Hi all @lucasolinas .
Thanks for the above solution. But I also need to download the zip file into the user local PC as well since the above code only download the zip file into server. Is there any code have to add in order to do so.
I use below code and it's work for me. $product = Product::find($id); if ($product->brochure_array != null) { $product->brochure_array = unserialize($product->brochure_array); //dd($product->brochure_array); if (!is_dir('zipFiles')) { mkdir('zipFiles'); } if (!isdir('zipFiles/brochure')) { mkdir('zipFiles/brochure'); } $brochureName='zipFiles/brochure/brochure'.time().'.zip'; Zipper::make($brochureName)->add([$product->brochure_array])->close();
return response()
->download(public_path($brochureName));
} else {
return redirect()->back()->with('error', "Opps! Invalid request");
}
Hi @Chumper
Thanks for make the zipper. i have an error when try to downloading the zip after create new zip
i have this for make zip and download it. after that, i delete it in the server
i have error that the file is doesnt exist. but when i click back and try to download again, its work well. any solution? thanks!