Skip to content

Commit fd01b5a

Browse files
committed
update image
1 parent e1c9e59 commit fd01b5a

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

controllers/itemController.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ exports.item_update_get = function (req, res, next) {
177177
};
178178

179179
exports.item_update_post = [
180-
upload.none(),
180+
upload.single('avatar'),
181181

182182
body("name", "Title must not be empty.").trim().isLength({ min: 1 }).escape(),
183183
body("price", "Price must not be empty.")
@@ -202,6 +202,10 @@ exports.item_update_post = [
202202
_id: req.params.id,
203203
});
204204

205+
if (req.file) {
206+
item.filename = req.file.filename;
207+
}
208+
205209
if (!errors.isEmpty()) {
206210
async.parallel(
207211
{

0 commit comments

Comments
 (0)