这是我在终端中看到的输出。
{ fieldname: 'file',
originalname: '161.jpg',
encoding: '7bit',
mimetype: 'image/jpeg',
destination: '../uploads/',
filename: '9152edf1ad886a4241d89374c5edaa8f',
path: '..\\uploads\\9152edf1ad886a4241d89374c5edaa8f',
size: 163804 }
Unhandled rejection MalformedXML: The XML you provided was not well-formed or di
d not validate against our published schema
我的代码如下
router.post('/image', upload.single('file'), function(req, res) {
var file = req.file;
console.log(file)
var stream = fs.createReadStream(file.path);
return s3fsImpl.writeFile(file.originalFilename, stream).then(function () {
fs.unlink(file.path, function (err) {
if (err) {
console.error(err);
}
});
res.status(200).end();
});
});
不确定什么是错的,一切似乎都对我有意义。我唯一觉得奇怪的是路径的价值,为什么它有两倍\\