php - Laravel production image link
one text
I am uploading an image like this in Laravel 8:
public function upload(FileRequest $request)
{
$image = $request->file('file');
$fileName = time().'.'.$image->getClientOriginalExtension();
$image->storeAs('/public/images/', $fileName);
return
[
'path' => asset('/public/images/'.$fileName)
];
}
The image get uploaded with the following link: http://{my api url}/public/images/1615123445.JPG. My API is at api.citynfo.info address. It is stored on server in the api folder. The images got save in {my api folder}/storage/app/public/images folder.
But when I want to read this image in my React application, there is no image returned. On server i have 3 folders:
- app: there is my React app
- api: thats where is my Laravel public folder
- webApi: thats where my Laravel api is
My question is where and how to save image so I can link it in my React app.
thnx
Source