F
Filament3mo ago
blink

->downloadable() image is opened within browser rather than download

It downloads as expected when disk is local but in case s3 image is opened in browser when clicking download icon. What may be a reason and solution? Thanks
5 Replies
Mohamed Ayaou
Mohamed Ayaou3mo ago
when it is local (under filament controll) filament will add a header to the URL to download it, but with S3 filament cannot controll its headers. you need to manage that with your S3 provider to add download headers to the responses for some cases
blink
blinkOP3mo ago
Thanks for replying, I've access to bucket, can you suggest how can I resolve this?
Mohamed Ayaou
Mohamed Ayaou3mo ago
Set Metadata in S3 Console: Select the file, click Properties, and Edit Metadata. Add a custom header Key: Content-Disposition Value: attachment; filename="filename.png" but this will make the url always downloadable I do not remeber a way to make conditional or something like that for now
blink
blinkOP3mo ago
Got it. It is file upload filed so doing this for each file does not make sense
Mohamed Ayaou
Mohamed Ayaou3mo ago
i think you can make it global on all files in the bucket or under specific folder Sorry but I do not remember S3 config rn

Did you find this page helpful?