I am trying to use FileDrop.js (latest version) along with Laravel 5.1 in order to upload files.
I have set a route for the ajax request inside routes.php:
Route::any('/fileupload/ajax', ['as' => 'fileupload.ajax', 'uses' => 'FileUpload@ajaxRequest']);
and that jquery code to catch file drop in my respective blade:
$('.filedrop')
.filedrop()
.on('fdsend', function (e, files) {
var ajaxUrl = '{{ route('fileupload.ajax') }}';
//code here
files.invoke('sendTo', ajaxUrl);
})
.on('filedone', function (e, file) {
//code here
});
The problem is that ajax call returns Laravel's "Page not found!".
It seems like FileDrop.js bypass laravel routing.
Any ideas.