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

OskarB's avatar

Laravel cannot upload images or link storage on Shared Hosting

I have just recently uploaded my Laravel site to shared hosting, but I am not getting my link to storage to work. Uploading images through my controllers does not work, but I'm assuming it's because the link is not correctly set up in the production environment

Doing php artisan storage:link gives me the error symlink(): No such file or directory. From checking some other posts, it seemed like the solution was to simply delete the old storage folder in the public file, but this action did not solve my issue.

I have also read in some way that you could manually create a link, but how would that be done?

My method for storing the image is as follows:

if (request('img_path')) {
            $imagePath = request('img_path')->store('project_images', 'public');
        }

Is this a correct way, or is there some other way to do this? With Storage::, or similar?

Any one have any ideas how to solve this?

0 likes
4 replies
anilkumarthakur60's avatar

create new route as

Route::get('/foo', function () {
    Artisan::call('storage:link');
});

storage:link should be done again in the production phase after hitting the url websitename.com/foo should work

OskarB's avatar

Returns same error.

I opted for AWS S3 storage instead

jlrdw's avatar

Laravel cannot upload images or link storage on Shared Hosting

Upload to another folder. If you need secure, see https://laravel.io/forum/04-23-2015-securing-filesimages

Serve via a route and make an image controller. I usually include the user id somewhere in name, and Auth is required.

If they don't need to be secure just upload them in public, and use regular image tag when needed using the asset helper.

But have you tried to ssh in with putty to set the symlink?

Please or to participate in this conversation.