I want to save the route of an image in the database. In my table I have an image field which is a string field.
And the code to save the image is this:
Question::create([
'title' => $request->title,
'slug' => $request->slug,
'image' => Storage::put('imagenapp', $request->file('image')),
'evaluation_id' => $request->evaluation_id,
'type' => "OMI",
]);
The input in the view is this:
<input type="file" name="image" id="image" class="form-control-file" accept="image/*">
I already have changed this line of code in filesystems.php file:
'default' => env('FILESYSTEM_DISK', 'public'),
And this line in the .env file:
FILESYSTEM_DISK=public
But when I try to store the data in the database I have the next error:
LeagueFlysystemFilesystem::write(): Argument #2 ($contents) must be of type string, null given, called in C:xampphtdocsaplicacionunovendorlaravelframeworksrcIlluminateFilesystemFilesystemAdapter.php on line 360
2
Answers
I found the mistake, I missed this code in the form:
Try this