Zipper icon indicating copy to clipboard operation
Zipper copied to clipboard

Error when opening the .ZIP file

Open Alique opened this issue 10 years ago • 7 comments

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 !

Alique avatar Mar 17 '15 19:03 Alique

Can you show some code?

Chumper avatar Mar 17 '15 19:03 Chumper

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>";
    }
}

Alique avatar Mar 17 '15 19:03 Alique

you are not closing the zip file, try with:

Zipper::make('/tmp/24x7project' . $project->id . '.zip')->add($path)->close();

Chumper avatar Mar 17 '15 19:03 Chumper

uhmmm, no luck, same error...

Alique avatar Mar 17 '15 19:03 Alique

hm... can you open it on the server?

Chumper avatar Mar 17 '15 19:03 Chumper

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?

Alique avatar Mar 17 '15 19:03 Alique

No, sorry, my guess is to look what Response:;download exactly does.

Chumper avatar Mar 17 '15 21:03 Chumper