Hi I am trying to integrate Dropzone.js in my app and using Laravel Framework. I have a form with below code,
<form method="post" action="{{url('/example/fileupload')}}"
enctype="multipart/form-data" class="dropzone" id="my-awesome-dropzone">
@csrf
<input type="submit">
</form>
The laravel controller attached with this form has below code in which I am just trying to get the name if the image which is dropped in dropzone area,
public function fileupload(Request $request)
{
$file = $request->file('file');
$filename = $file->getClientOriginalName();
echo $filename;
}
After clicking submit button it shows me below error,
Call to a member function getClientOriginalName() on null
Dont know what I am doing wrong here, because when I try to run the same code with simple
<input type="file" name="file">
it shows me the name of the uploaded image file which I want. Any suggestion or fix? Thanks