I have an image upload form in my Laravel project.
I want to save the uploaded image into public/images/
location.
But image upload into public/app/images
location.
From where this app
is coming!!
config/filesystem.php
'disks' => [
'local' => [
'driver' => 'local',
'root' => public_path(''),
],
'public' => [
'driver' => 'local',
'root' => public_path(''),
'visibility' => 'public',
],
's3' => [
'driver' => 's3',
'key' => 'your-key',
'secret' => 'your-secret',
'region' => 'your-region',
'bucket' => 'your-bucket',
],
],
controller
if($this->request->hasFile('photo'))
{
$image_url = $this->request->photo->store('/images/campaign/large');
$image = substr($image_url, strrpos($image_url, '/') + 1);
}
I have applied the same code in my local project. Image uploaded there in the correct location.
But this problem happens in my cPanel server project. I have already clear cash in live server.
Where is the mistake?
3
Answers
I think this Controller code help you.
Maybe you can chmod -R 777 your directory file, if you using linux or mac os, or you cant clear the cache, because yesterday in my office .
This of full :
https://kb.iu.edu/d/ahic
I think you have missed to create a symbolic link for the storage path.
Please follow this link: Larvel Public Disk
In short you need to run this
php artisan storage:link