File Access In Laravel

Asked by At

I'm developing a web app and I want to store .pdf files in a folder outside the project root directory and still be able to access those files from the web app using the "a href" tags. How do I go about achieving this objective in Laravel?

Your assistance will surely be appreciated

Example

    some folder
        |---> web app
        |     |------> index.php
        |     |------> css
        |     |------> js
        |
        |---> file folder

2 Answers

0
FunkyMonk91 On

There is a folder called storage that is at the root level of the laravel application that can handle this kind of thing.

https://laravel.com/docs/5.8/filesystem#the-public-disk

0
Elminson De Oleo Baez On

You can add a soft link to the directory or you can create a new folder inside public folder. The soft link needs to be a full path.

some folder
        |---> web app
        |     |------> pdfFolder/ (ln -s  to hiddenFolder) 
        |     |------> index.php
        |     |------> css
        |     |------> js
        |
        |---> hidefolder