Skip to content
This repository has been archived by the owner on Feb 25, 2020. It is now read-only.

Error when opening the .ZIP file #43

Open
Alique opened this issue Mar 17, 2015 · 7 comments
Open

Error when opening the .ZIP file #43

Alique opened this issue Mar 17, 2015 · 7 comments

Comments

@Alique
Copy link

Alique commented Mar 17, 2015

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 !

@Chumper
Copy link
Owner

Chumper commented Mar 17, 2015

Can you show some code?

@Alique
Copy link
Author

Alique commented Mar 17, 2015

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

@Chumper
Copy link
Owner

Chumper commented Mar 17, 2015

you are not closing the zip file, try with:

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

@Alique
Copy link
Author

Alique commented Mar 17, 2015

uhmmm, no luck, same error...

@Chumper
Copy link
Owner

Chumper commented Mar 17, 2015

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

@Alique
Copy link
Author

Alique commented Mar 17, 2015

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?

@Chumper
Copy link
Owner

Chumper commented Mar 17, 2015

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants