I post here because I'm developping an API with SailsJS , and when I want to upload a file with an android app client , I've got a problem.
Req.files / req.file('myfile') is empty.
This my source to perform upload :
//FileController.js
upload: function (req, res) {
console.log("REQ ", req.file('image'));
console.log(req.files.image.originalFilename);
console.log(req.files.image.path);
req.file('image').upload({ dirname: '../../assets/images/profile/'},function (err, uploadedFiles){
if (err){
return res.serverError({
code : 500,
status : res.i18n('error'),
notice : res.i18n('An error has occurred.'),
object : { error:error }
});
} else{
return res.ok({
code : 200,
status : res.i18n('OK'),
notice : res.i18n('Avatar uploaded.'),
object : uploadedFiles
})
}
});
}
I work with Sails v0.11.0
Nota. : My android client app works great with an other nodeJS app.
Do you have an idea to fix problem ?
Thanks.