Im having issues with a file upload in laravel 5.7
I think i have done everything correctly but the file never reaches the controller.
Here is my form:
<form action="" method="post" enctype="multipart/form-data">
@csrf
<div class="form-group">
<input id="module" type="file" class="form-control-file" name="module">
</div>
<button type="submit" class="btn btn-raised btn-success btn-iconText float-right">Install<i class="material-icons">add_circle_outline</i></button>
</form>
My route:
Route::post('/modules', 'ModuleController@store')->name('modules.store');
My controller function:
public function store(Request $request)
{
//dd($request->hasFile('module'));
dd($request->all());
return redirect()->route('modules.index');
}
The hasFile()-Method returns false. $request->all() contains the following:
array:2 [
"_token" => "ceMpab3FqZU4qsHo7QTvRwKMTr2zLgc0krbcieJj"
"module" => "example.png"
]
I have no idea what im doing wrong. Hopefully some can help me.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire