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

alihoushyaripour's avatar

How to access files that uploaded in storage directory with url?

Hi,

I write a code to upload photo, this is that:

// parameters
$name = 'image.jpg';
$fileName = $_FILES[0]['name'];
$path = '/image/';

// upload
request()->file("$name")->storeAs($path, $fileName);

Photo uploaded successfully but I don't have access to storage directory of my project with url, I test these urls and none of them is true:

http://127.0.0.1:8000/public/storage/image/image.jpg
http://127.0.0.1:8000/storage/image/image.jpg
http://127.0.0.1:8000/public/image/image.jpg
http://127.0.0.1:8000/image.jpg
http://127.0.0.1:8000/public/image.jpg
http://127.0.0.1:8000/storage/app/image/image.jpg
http://127.0.0.1:8000/storage/app/image/image.jpg
http://127.0.0.1:8000/app/image/image.jpg
http://127.0.0.1:8000/public/app/image/image.jpg

Also I set permission 777 for storage and storage/image directories and image files, but not work.

What should I do?

0 likes
4 replies
Snapey's avatar

have you created the symlink that makes storage/public appear as http://127.0.0.1/storage. ?

you then need to store the file in storage/public/images and not storage/images

_Artak_'s avatar
// upload

$path = '"public/image/';

request()->file("$name")->storeAs($path, $fileName);


run php artisan storage:link


//example.blade.php

<img src="/storage/image/imageName.ext" alt="img">


2 likes
alihoushyaripour's avatar

@Snapey How to make it? with below artisan command symlink created for public/storage dir and not storage/public dir.

php artisan storage:link
Snapey's avatar
Snapey
Best Answer
Level 122

the link command creates a symbolic link from the url http://mysite.com/storage into the laravel_project/storage/public folder.

Therefore there is no point in putting images in laravel_project/storage/images because they will not be accessible to the outside world

1 like

Please or to participate in this conversation.