mercredi 10 février 2016

laravel5.1 download file from storage system

How to use the storage system to generate a file download?

Is there a function I can use to get the complete path of file or how to get this working? I would like to use the storage systems functions and not "hardcode" the mainpath into my app.

    $path = "app/storage/uploads/xy.zip";
        return response()->download($path);

I know using

$path = storage_path('uploads/xy.zip');

would work, but how can I define the storage system? I would like to retrieve the file using the storage system and using ->download(), because this function sets the correct headers already.

I would like to be able to change the storage system easily,



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire