So I created a form that can post images like this, and tried to process the images as I examined view
<form action="{{ $action }}" enctype="multipart/form-data" method="post">
<input type="file" name="imagefile" accept="image/*">
<input type="text" name="content">
<button tyoe="submit">OK</button>
</form>
Processing with the controller took out the image and saved the place while watching other people's blog
$post_data = $request->except('imagefile');
$imagefile = $request->file('imagefile');
$temp_path = $imagefile->store('public/temp');
$a = new Test;
$a->fill($request->all())->save();
I thought it was going well, but there was an error
Cannot insert value NULL into 'imagefile'
I checked after that but the cause is not understood.
enctype="multipart/form-data"
, like this :<form method="post" action="example.cgi" enctype="multipart/form-data">
$a->fill($request->all())->save();
, because imagefile was set to object "a" ,imagefile field/column be null, you try to debug, set$a->imagefile
be an empty string beforesave
(insert) it.