When i upload a file in Node JS, ajax request send to Lumen. But the request is empty.
This happen only on server, In my localhost working fine.
Please advice..
Ajax request :
uri: config.apiEndpoints.uploadStatement,
headers: {
'Authorization': token
},
method: 'POST',
formData: {
lender: "lender",
product: "product",
source: "statement",
"document[]": formData[1].statement ? fs.createReadStream(formData[1].statement[0].path) : "",
"document_key[]": formData[0].password[0],
}
Lumen :
public function uploadstatement(Request $request)
{
\Log::info(json_encode($request->all()));
$basicRules = [
'lender' => 'required|in:'.implode(',', config('api.lenderList')),
'source' => 'required|in:'.implode(',', config('api.sources'))
];
$validator = Validator::make($request->all(), $basicRules, [
'lender.in' => 'Requested lender doesn\'t exist in our list',
'source.in' => 'Requested source doesn\'t exist in our list'
]);
if ($validator->fails()) {
return $this->showValidationResponse($validator->messages());
}
}
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire