I want to embed a pdf from storage into a view/iframe. The storage is private and I can’t permanently store the files on public folder.
Is there any way to accomplish this? Now the users need to see the pdf directly on page instead of downloading it.
I thought copying the file to public and delete it after being served, it’s a valid approach?
Thanks for any guidance!
2
Answers
Maybe you can try using temporary URLs. Check docs here https://laravel.com/docs/11.x/filesystem#temporary-urls
If you need a more robust logic, add to that new endpoint a simple check for user authentication before serving the file.
Try using temporary urls given by laravel like so: