I am new to sails js.In my code I am getting file from front-end but the file was showing error like below.Even my uploaded file is not saving in back-end folder.Once check my code .
upload: function(req, res) {
if (req.method === 'GET')
return res.json({ 'status': 'GET not allowed' });
console.log("Get function is Excuted");
var uploadFile = req.file('uploadFile');
console.log(uploadFile);
uploadFile.upload({ dirname: './assets/images' },function onUploadComplete(err, files) {
if (err) {
console.log(" Upload file is error");
return res.serverError(err);
}
// IF ERROR Return and send 500 error with error
console.log(files);
res.json({ status: 200, file: files });
});
},
error code:
I am getting error in sails js console is this.
HTML code:
In my code I am facing a small problem please check it.Better to give any upload file example in sails js.