From 41cb81b11b9a511e9c369d83b03bff3bb4d21193 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=88=91=E7=9A=84=E4=BB=A3=E7=A0=81=E8=A2=AB=E8=96=9B?= =?UTF-8?q?=E5=AE=9A=E8=B0=94=E7=9A=84=E7=8C=AB=E5=90=83=E4=BA=86?= <778811xxx@163.com> Date: Sat, 15 Jul 2017 15:03:52 +0800 Subject: [PATCH] Update ue.js MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit uniqueId是做什么用的? 如果没什么用,上传图片的时候,如果为空,则创建一个吧,不然,拖动图片到ueditor里无法上传 --- routes/ue.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/routes/ue.js b/routes/ue.js index 515c1e7..5be86f1 100644 --- a/routes/ue.js +++ b/routes/ue.js @@ -9,6 +9,7 @@ var shortid = require('shortid'); //图片上传配置 var storageImg = multer.diskStorage({ destination: function (req, file, cb) { + req.query.uniqueId = req.query.uniqueId?req.query.uniqueId:new Date().getTime()+''; if (req.query.uniqueId) { var dirPathParent = path.join(__dirname, '../public/uploads/', req.query.uniqueId), dirPath = path.join(dirPathParent, 'img');//不能直接创建dirPath,因为父目录不存在会抛出异常 @@ -222,4 +223,4 @@ router.post('/', function (req, res, next) { } }); -module.exports = router; \ No newline at end of file +module.exports = router;