php - Laravel[9] not saving UploadedFile to storage [in Windows]
one text
I'm trying to save an image in to public storage.
/**
* Store the Post heading image to public storage
*
* @param Illuminate\Http\UploadedFile $image
* @return string|false returns the path of stored image
*/
private function storeImage($image)
{
$name =
date('Y-m-d H:i:s')
. '.'
. $image->getClientOriginalExtension();
// $path = $image->storePubliclyAs('public/images', $name); // returns false
$path = Storage::putFileAs('public/images', $image, $name); // returns false
dd($path); // shows false
}
the Http response code is 500. but it shows dd
page with no errors.
tried to add this code below to public/index.php
to see more information:
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
but still dd
page shows no errors only false value of the $path
.