Looks like local is wrong. You should be getting the file from the storage folder.
Are your filesystem settings the same between systems?
Where is the file actually stored?
Hi,
I am trying to understand the laravel file saving structure. My overall issue is moving from local to my server. I created a very simple project to test file saving and understand it better. I have already done the php artisan storage:link. In my web.php file I have
Route::post('process', function (Request $request) {
// cache the file
$file = $request->file('photo');
// generate a new filename. getClientOriginalExtension() for the file extension
$filename = 'profile-photo-' . '.' . $file->getClientOriginalExtension();
// save to storage/app/photos as the new $filename
$path = $file->storeAs('public', $filename);
});
When I am on local I can call this file by using
<img src="/profile-photo-.jpg">
My issue is when I upload my project to the server I now have to use
<img src="/storage/profile-photo-.jpg">
I must be doing something wrong because it can't be default that I would have to change all my link urls whenever I move between local and server.
Thanks!
So if your document root is public, then the img src should be "/storage/filename.jpg"
Check you don't have two copies of the file on your local machine and you are displaying the wrong one
Please or to participate in this conversation.