Skip to content

Commit

Permalink
[#44] Feat: file==undefined 일시 에러 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
inyeoptti committed Oct 15, 2022
1 parent 66acdbd commit a6272d4
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions backend/src/api/routes/image.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ const router = Router();
// Content-Type: multipart/form-data
// Requires field(name=img) with image data
router.post("/upload", upload.single('img'), (req, res) => {
if(!req.file) return res.status(400).json("File Attachment is undefined");

const { fieldname, originalname, encoding, mimetype, destination, filename, path, size } = req.file;

res.json({ path: `/images/${filename}` });
Expand Down

0 comments on commit a6272d4

Please sign in to comment.