lundi 2 mai 2016

why i can't open file that have been downloaded from the server using laravel

so i try to make a server that can be provide user to download some file(.xlsx) from server. My problem is why when I was completing downloading file from the server, the file can not be open?

this is my code:

Route::get('/dl/{filename}', function($filename)
{

    //get file name and the file path
    $path =  "assets/.../".$filename;
    if (file_exists($path))
    {
        //download the file
        return Response::download($path, $filename, [
            'Content-Length: '. filesize($path)
        ]);
    }
    else
    {
        exit('no file');
    }
});



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1rNRQ0h
via IFTTT

Aucun commentaire:

Enregistrer un commentaire