here's my html
<input type="file" class="form-control" name="file-name" id="file-id">
here's JS that is supposed to send file to api
var file = $('input#file-id').val();
$.post('my/url/that/works', {
file: file,
volume: volume
}).done(function () {
//something
}).fail(function () {
//something else
});
and finally my method in Laravel:
public function ajaxMethod(Request $request)
{
if ($request->hasFile('file')) {
echo "it does";
}else{
echo "it does not"; // <- that happens
}
var_dump($request->getContent());//vardumps ('C:/fakepath/[correct_filename])
}
and the ajax call says that it does not has a file. I think that I upload only file name, but not the file. How can I change it?