Zipper
Zipper copied to clipboard
Error when opening the .ZIP file
Hello, I've managed to zip the file but I'm having this error when downloaded and trying to open it:
Archive: /home/alique/Downloads/24x7project5.zip [/home/alique/Downloads/24x7project5.zip] End-of-central-directory signature not found. Either this file is not a zipfile, or it constitutes one disk of a multi-part archive. In the latter case the central directory and zipfile comment will be found on the last disk(s) of this archive. zipinfo: cannot find zipfile directory in one of /home/alique/Downloads/24x7project5.zip or /home/alique/Downloads/24x7project5.zip.zip, and cannot find /home/alique/Downloads/24x7project5.zip.ZIP, period.
Does anyone know why this might be?
Thanks a lot before hand !
Can you show some code?
Sure! here's how I am doing it:
public function getDownload(Project $project) {
$project->load('projectFiles');
$files = $project->project_files;
$path = array();
foreach ($files as $aFile) {
$path[] = $aFile->url;
}
echo "Pasa por acá y el proyecto es el: " . $project->id;
Zipper::make('/tmp/24x7project' . $project->id . '.zip')->add($path);
if (is_file('/tmp/24x7project' . $project->id . '.zip')) {
return Response::download('/tmp/24x7project' . $project->id . '.zip');
} else {
echo "<script>alert('Error: the file wasn't found); location.href('http://wwww.24x7translation.com');</script>";
}
}
you are not closing the zip file, try with:
Zipper::make('/tmp/24x7project' . $project->id . '.zip')->add($path)->close();
uhmmm, no luck, same error...
hm... can you open it on the server?
Oh yes I can, why can't open it in my local folder? I recon the problem is not in your repository but somewhere in my code, any clues tho?
No, sorry, my guess is to look what Response:;download exactly does.