Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

johnw65's avatar

File Admin/File Upload without Symlink

I'm in a process of developing a file admin/file upload module which consists of documents and images. Unfortunately, we are not allowed to use symlink in our environment.

I want the admin to upload files so the users can view them. But also allow the users to upload. So I want to create a link so when the user clicks on the link, that they are view/download the document.

What is the best approach and where do I set up the file storage?

0 likes
4 replies
illuminatixs's avatar
Level 4

Hi @johnw65 ,

My first question: Would it be an issue if the file is publicly accessible if the URL is known? If not: You can upload the files directly in the public dir.

In config/filesystems.php you would have to add a new disk:

'public_uploads' => [
    'driver' => 'local',
    'root'   => public_path() . '/uploads',
],

And store files like this:

if(!Storage::disk('public_uploads')->put($path, $file_content)) {
    return false;
}

No symlinks needed to access the newly uploaded files, but they are accessible for everyone that knows the url.

johnw65's avatar

@illuminatixs

Will a setting below work?

'public' => [ 'driver' => 'local', 'root' => storage_path('app/public)', ],

Please or to participate in this conversation.