Authored by 姜敏

图片上传(单张 修改)

@@ -105,6 +105,7 @@ exports.uploadFile = function (req, res) { @@ -105,6 +105,7 @@ exports.uploadFile = function (req, res) {
105 res.json(errBackMsg); 105 res.json(errBackMsg);
106 }); 106 });
107 } else { 107 } else {
  108 + req.body.file = fs.createReadStream(req.files[req.body.filename].path);
108 request.post({ 109 request.post({
109 url: domain + '/fileupload/upload', 110 url: domain + '/fileupload/upload',
110 formData: req.body 111 formData: req.body
@@ -166,7 +167,7 @@ function joinimg(url) { @@ -166,7 +167,7 @@ function joinimg(url) {
166 exports.ueditor = function(req, res) { 167 exports.ueditor = function(req, res) {
167 var headers = {}; 168 var headers = {};
168 if (req.session && req.session.user) { 169 if (req.session && req.session.user) {
169 - var ipObject = ipaddr.process(req.ip).octets 170 + var ipObject = ipaddr.process(req.ip).octets;
170 var ip = ipObject ? ipObject.join('.') : req.ip; 171 var ip = ipObject ? ipObject.join('.') : req.ip;
171 172
172 headers = { 173 headers = {
@@ -182,8 +183,6 @@ exports.ueditor = function(req, res) { @@ -182,8 +183,6 @@ exports.ueditor = function(req, res) {
182 message: "用户失效,请重新登录" 183 message: "用户失效,请重新登录"
183 }); 184 });
184 } 185 }
185 -  
186 - console.log(req.files);  
187 if (req.is("multipart/form-data")) { 186 if (req.is("multipart/form-data")) {
188 req.body.file = fs.createReadStream(req.files.upfile.path); 187 req.body.file = fs.createReadStream(req.files.upfile.path);
189 req.body.bucket="goodsimg"; 188 req.body.bucket="goodsimg";