I would like to integrate multer
https://www.npmjs.com/package/multer file upload package in my sails.js
framework application unfortunately there is no tutorial avaliable for it.
Can anyone give a guidance how to do it in sails.js??
I also came across this problem and wasn't able to find anything on internet but after reading sails.js
documentations, I figured out a way to upload files.
Internally sails.js
uses skipper
to upload files and the code is pretty straightforward for it.
var uploadFile = req.file('user_picture');
uploadFile.upload({ dirname: filePath }, function onUploadComplete(err, files) {
if (err) return res.serverError(err);
// IF ERROR Return and send 500 error
console.log(files);
});
The user_picture
is the name of the variable in your form.
Hope this helps!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With