Hi I have a form which is using dropzone.js as below,
<form method="post" action="{{url('/example/fileupload')}}" enctype="multipart/form-data" class="dropzone" id="dropzone">
@csrf
<input type="submit">
</form>
I am using below code to configure dropzone.js
<script type="text/javascript">
Dropzone.options.dropzone =
{
maxFilesize: 12,
acceptedFiles: ".jpeg,.jpg,.png,.gif",
addRemoveLinks: true,
timeout: 5000
};
</script>
Its working on front-end means it shows images uploading in just dropzone view. I want to ask how can I call my laravel controller function from here. That function has all the logic for renaming the image files and saving it in database. The function (named fileupload) should be called after I click the submit button. I have already created the routes as below,
//just output the view with dropzone area
Route::get('/example','exampleController@show');
//fileupload function contains all the logic of renaming and saving image iles
Route::post('/example/fileupload','exampleController@fileupload');