Actually force the download in S3
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
|
||||
namespace App\Helpers;
|
||||
|
||||
use Illuminate\Contracts\Filesystem\FileNotFoundException;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Symfony\Component\HttpFoundation\BinaryFileResponse;
|
||||
@@ -20,7 +19,14 @@ class StorageHelper
|
||||
return response()->download(Storage::disk($disk)->path($filename)); // works for PRIVATE or public?!
|
||||
|
||||
case 's3':
|
||||
return redirect()->away(Storage::disk($disk)->temporaryUrl($filename, now()->addMinutes(5))); // works for private or public, I guess?
|
||||
Storage::disk($disk)->temporaryUrl(
|
||||
$filename,
|
||||
now()->addMinutes(5),
|
||||
[
|
||||
'ResponseContentType' => 'application/octet-stream',
|
||||
'ResponseContentDisposition' => 'attachment; filename=download-file',
|
||||
]
|
||||
);
|
||||
|
||||
default:
|
||||
return Storage::disk($disk)->download($filename);
|
||||
@@ -119,5 +125,4 @@ class StorageHelper
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user