Hi there,
I've recently made a new laravel project, where I can upload images for specific models. I created a symlink using php artisan storage:link and images are loaded in correctly by doing <img class="image rounded-circle" src="{{asset('storage/img/profile_img/'.$user->image)}}" /> for example. I uploaded my project on a shared hosting. But for some reason uploaded images wont go to the symlink. Some static images are working. (which are already in the folder). But whenever I try to upload an image, it is being stored in the original /storage, but not in the public_html/storage. I already tried running the storage artisan command via a route and some other common ways to fix it. But without any luck.
I managed to fix the issue. I'm not sure why. But for some reason the generated storage link locally didn't work on my shared hosting. By copying all files from public to /public_html I guess somehow /storage became an actual folder instead of a symlink one, I removed the folder and ran this script
@Snapey All files/folders that are normally located in the /public folder are in /public_html. And all other files/folders, for example controllers/models/views/env are located in a a different folder. So I had to change 2 filepaths in the index.php. Is that the correct way for a shared hosting, or am I doing something wrong?
@janmoes That is fine! Some time ago I used to upload my files to a shared hosting that way too. I saw Brad from Traversy Media on youtube doing it that way. He stated that it is not the optimal way to do it, but it gets the job done.
Here is the link if you want to check it out.
https://www.youtube.com/watch?v=6g8G3YQtQt4&t=482s&ab_channel=TraversyMedia
@bicicura Thanks! It's only a pain to update the website so now and often, my cpanel also doesn't have a CLI, and if it had a CLI, I'm not sure if it is still possible to run artisan commands with the way I uploaded the project?