I upload correctly my file in my Localhost, but when I upload my app in the server, they give me Error: Server Error after uploading the file.
This is my controller :
$exploded = explode(',', $request->image);
$decoded = base64_decode($exploded[1]);
if(str_contains($exploded[0], 'jpeg'))
$extension = "jpg";
else
$extension = "png";
$fileName = str_random().'.'.$extension;
$path = public_path().'/'.$fileName;
file_put_contents($path, $decoded);
$person->photo = $fileName;
In my localhost, files are saved in the public folder. I would like to save my files in my serve in public_html or in public_html/image.
storage
folder? – Seva Kalashnikov