I want to upload multiples images and store her URL into a database.
Here's my code:
<form method="POST" action="{{ route('validated', ['id' => $product->id]) }}) }}">
@csrf
<input type="hidden" name="ID" name="ID" value="{{ $product->id }}">
<div class="form-group row">
<label for="Image" class="col-sm-2 col-form-label">Image</label>
<img src="{{ $product->imageURL }}" />
</div>
<div class="form-group row">
<div class="col-sm-12">
<button type="submit" class="btn btn-lg btn-success">Valider les données</button> | <a href="#">Relancer le fournisseur</a>
</div>
</div>
</form>
and into my Controller function:
$imagePath = Storage::putFile('uploads/image/', $request->image, "imagename");
I have this error:
Symfony\Component\Debug\Exception\FatalThrowableError thrown with message "Call to a member function hashName() on string"
Stacktrace: 0 Symfony\Component\Debug\Exception\FatalThrowableError in C:\laragon\www\MyProject\vendor\laravel\framework\src\Illuminate\Filesystem\FilesystemAdapter.php:208
<input type="file" name="image" />
element. and add the attributeenctype="multipart/form-data"
in the form tag<form method="POST" action="{{ route('validated', ['id' => $product->id]) }}) }}" enctype="multipart/form-data">
– Ibrahim Mohamed$request->file('image')
not$request->image
. – Ibrahim Mohamed