var form = new formidable.IncomingForm();
form.uploadDir="/localnonobank/test/images/"; //存储路径
form.on('file', function(name,file){
filepath=file.path;
filename=file.name;
});
form.parse(request, function(err,fields,files){
if(err){
throw err;
};
});
form.on('end', function() {
fs.rename(filepath,form.uploadDir+filename);
response.end(JSON.stringify({name:filename,src:form.uploadDir+filename}));
});