How can I download zip via ajax with response()->download() in laravel 5.1

Posted 3 years ago by danjavia

I try to download a zip file via ajax with response()->download() in laravel 5.1 but not function

Here is my code:

$zipper = new \Chumper\Zipper\Zipper;

    $files = glob( public_path() . '/css/' );
    $zipper->make( storage_path() . '/downloads/test.zip' )->add( $files );

    $headers = [ 'Content-Type' => 'application/octet-stream' ];

    return response()->download( storage_path() . '/downloads/test.zip', 'test.zip', $headers );

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.