87,910
社区成员
发帖
与我相关
我的任务
分享
var express = require('express');
var router = express.Router();
var connect_multiparty = require('connect-multiparty');
var multiparty = connect_multiparty();
/* GET home page. */
router.get('/', function(req, res, next) {
res.render('index', { title: 'Express' });
});
router.post("/",multiparty,function(req, res){
var target_path = __dirname + '\\upload\\jj.jpg' ;
// var target_path = __dirname + '/upload/jj.jpg' ;
console.log(" req.files.file.path=",req.files.file.path);
console.log("target_path===",target_path);
fs.renameSync(req.files.file.path, target_path, function (err) {
if (err) {
console.log("出错了===",err);
}
console.log(" target_path=",target_path);
console.log(" req.files.file.path=",req.files.file.path);
console.log(" 成功");
});
})
module.exports = router;