As the name, now I can not check the file type before downloading. I check and do not allow saving data after a successful file upload. Below is the base code
updateAvatar : function(data, context, req, res) { req.file('avatar').upload({ dirname: '../../assets/images/avatar' }, function (err, files) { var allowExts = ['image/png', 'image/gif', 'image/jpeg']; if (err) return res.serverError(err); if (files.length === 0) return res.badRequest('No file was uploaded!'); if (allowExts.indexOf(files[0].type) == -1) return res.badRequest('File type is not supported!');
What should I do for the correct code? Sorry for my bad english! Thank you very much!
source share