node.js - Skipper gridfs validating and express response issue -
i upload images mongodb skipper-gridfs module in express.js application. uploading codes follows
upload: function (req, res) { req.file('avatar') .upload({ adapter: require('skipper-gridfs'), uri: 'mongodb://localhost:27017/test.images' }, function (err, uploadedfiles) { if (err) return res.negotiate(err); else return res.ok({ files: uploadedfiles, }); }); } following response this... { "files": [ { "fd": "2d8910a0-8ca2-4df1-9930-6ddd721a0416.jpg", "size": 172883, "type": "image/jpeg", "filename": "photo on 12-20-14 @ 9.53 pm.jpg", "status": "bufferingorwriting", "field": "avatar", "extra": { "fileid": "54aee6ced4a0e88f0dc9025f", "fd": "2d8910a0-8ca2-4df1-9930-6ddd721a0416.jpg", "dirname": "." } } ] } sending image in post request using google chrome rest client, , question need check file size , type before uploading file in db , shall ?
can me on ? in advance.
Comments
Post a Comment