1
votes

I have created a web application with Laravel 7 in the local environment and it has an option where users can upload and change their profile image. It works fine in the local environment. Recently I uploaded this project to a live server under a subdomain. I put all the public files in the subdomain folder and other files in root. Like this.
File Structure
And now when I run

php artisan storage:link

It uploads images inside files/public/images I need images into hello.example.com/images

File upload code:

if ($request->hasFile('profile_image')) {
    $image = $request->file('profile_image');
    $name = time() . '.' . $image->getClientOriginalExtension();
    $path = '/images/';
    $destinationPath = public_path('images');
    $image->move($destinationPath, $name);
    $user_image = '';
    if (isset($name)) {
        $user_image = $path . $name;
    }
}
1

1 Answers

0
votes

To whom it concern I have added this in my index.php

$app->bind('path.public', function() { return _DIR_; });

and remove fliestream.php links and it works for me