0
我正在通過Mulder將圖像上傳到./public/images ...它上傳得很好,我可以在文件夾中以及DB中正確關聯和所有..檢索並顯示通過Mulder上傳的圖像
這裏是後路線:
exports.postRevive = (req, res, next) => {
var reviveShowName = req.body.reviveShowName;
var reviveGoal = req.body.reviveGoal;
var reviveTitle = req.body.reviveTitle;
var reviveVideo = req.body.reviveVideo;
var reviveStory = req.body.reviveStory;
var reviveCategory = req.body.reviveCategory;
var revivePhoto = req.file.filename;
var author = {
id: req.user._id,
username: req.user.name
};
var newRevive = {reviveShowName: reviveShowName, reviveGoal: reviveGoal, reviveTitle: reviveTitle, revivePhoto: revivePhoto, reviveVideo: reviveVideo, reviveStory: reviveStory, author: author, reviveCategory: reviveCategory};
Revive.create(newRevive, function(err, newlyCreatedRevive) {
if(err) {
console.log(err);
} else {
res.redirect('/');
}
});
};
然後我查詢數據庫,並通過一切home.pug和home.pug我想要顯示它:
這裏是home.pug的代碼:
if revives
each revive, i in revives
.clearfix
a.slide.revive(href='#')
.media
img(src='/images/#{revive.revivePhoto}')
.funding
h2 $12,151 of #{revive.reviveGoal}
.funds
.fund-bar
.progress-bar(style='width:82%')
span.favorite
.copy
p.secondary 8.7/10 • Animation, Comedy
h3.ellipsis
h4=revive.reviveTitle
= revive.reviveTitle顯示出來,#{} revive.reviveGoal顯示出來...圖像不,我想不通爲什麼...