Skip to content
Advertisement

Laravel Storage rename file before downlaod

I want to rename a file in the moment before download it in Laravel 8.0:

I currently using the following code:

$link = Storage::cloud()->download($request->input('document'));

But I can’t find a way to rename it before download it. I don’t want to rename the file in S3.

Advertisement

Answer

You can pass second argument to download method as below

$link = Storage::cloud()->download($request->input('document'),"newfilename.extension");
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement