Hope you guys can help me. I'm using Uppy, with XHRUpload
plugin, to upload a file but I'm getting an empty array of $request
on the server side (Laravel) when I'm about to update a file using PUT
request. I've tried method spoofing but still no luck. Here's my code...
I'm using uppy.setMeta
by the way to add some additional data to the request.
uppyUploader.setMeta({
...($(this).data('action') != 'store') && { _method: 'PUT' }, // Method spoofing of Laravel but the original method is 'POST'
filename: $('input[name="filename"]').val(),
...
});
uppyUploader.upload();
but I got this in my update controller method's $request
$request->all(); // [] <-- empty array
To verify if the file is available in request you can use
$request->hasFile('filename')
To get the specific file from request you can use
$request->file('filename')
or$request->filename
To get all files from request, you can use
$request->allFiles()