dan3460's avatar

Displaying a File on the browser that is under the storage folder

I'm revamping an application that stores and display pdf files. When a file is uploaded is store under the storage folder which is not accessible from the browser. That is good. In the old application when an authenticated user wanted to see the file, we made a copy to a temporary folder under the public folder, from where it was uploaded to a . After reading the temporary file was deleted.

Is there another way to do this? I was reading about a function Storage::setVisibility, maybe i thought you can turn the visibility on and off to allow for the browser to read the file. But i don't know if that would work.

0 likes
2 replies
dan3460's avatar

Starting to remember the problem that we have the first time. When you use the download function it just download the file. In chrome shows on the bottom of the page where you can click and will open on a new tab. That is not the behavior that we are looking for. When the user clicks on the view button, we want the document to show up on the same page on a little iframe. To be able to push something on a iframe has to be publicly available, i think. That is why we grabbed a copy and put it on a temporary file under the public folder.

1 like

Please or to participate in this conversation.