Laravel shared hosting app, storage symbolic folder
I created a symbolic link on my local PC where it works fine, but I uploaded it to shared hosting it doesn't work there. Basically I have images in storage folderroot/storage/public/images/
I want to show them by receiving
$path=asset('storage/images/'.$item->image);
so the problem is shared hosting this way
$path=asset('storage/images/'.$item->image);
get from the domain directory not from the parent directory, so there is no way for this to create a symbolic link on shared hosting for me to do to get images from the parent directory. I am a beginner in laravel, I can help solve this problem. thank
source to share
Create a folder with a storage folder in which the same folder in the project file library will be created. For more information, Symbolic Links Using PHP
source to share
I have the same problem and this article helps me. I created a symlink with SSH access, but it can also work with Cpanel's CronJob utility.
source to share
first remove the store folder from public folder and using this code in web.php
Route::get('foo', function(){
$targetFolder = $_SERVER['DOCUMENT_ROOT'].'/project_foder/laravel/storage/app/public';
$linkFolder = $_SERVER['DOCUMENT_ROOT'].'/project_foder/public/storage';
symlink($targetFolder, $linkFolder);
return 'success';
});
or
Route::get('foo', function(){
Artisan::call('storage:link', []);
return 'success';
})
source to share