jquery - How to return the new files name when set defer=true in express.bodyParser -
express config: server.configure(function () { server.use(express.bodyparser({ keepextensions:true, limit:100000000, defer:true, uploaddir: "d:/"}) ); upload controller: exports.upload = function(req, res){ req.form.on('progress',function(bytesreceived, bytesexpected){ res.send({loaded: bytesreceived, total: bytesexpected}); }); req.form.on('complete',function(){ if(!path.existssync(uploaddir)){ mkdirp(uploaddir, function (err) { if (err) console.error(err) saveimg(req, res); }); } else { saveimg(req, res); } }); }; var saveimg = function(req, res) { var scrname = req.files.files[0].path; var distname = uploaddir + uuid.v4() + '.png'; var gm = require('gm'); gm(scrname) .resize(1000, 1000) .autoorient() .write(distname, function (err) { fs.unlink(scrna...