Sails.js - file upload
This will get you most of the way there: https://github.com/balderdashy/sails/issues/27
You can use https://github.com/aconbere/node-file-utils to create directories, etc. Install it with
npm install file
Require file in the module having code similar to that in .../sails/issue/27.
This blog has has a good example of handling a file upload--it worked for me:
http://maangalabs.com/blog/2014/08/12/uploading-a-file-in-sails/
upload: function (req, res) { // Call to /upload via GET is error if(req.method === 'GET') return res.json({'status':'GET not allowed'}); var uploadFile = req.file('uploadFile'); console.log(uploadFile); uploadFile.upload(function onUploadComplete(err, files) { // Files will be uploaded to .tmp/uploads // IF ERROR Return and send 500 error with error if (err) return res.serverError(err); console.log(files); res.json({status:200,file:files}); });}