Created
June 22, 2020 12:52
-
-
Save pavinduLakshan/032da80132e880778817af239a79160e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var express = require("express"); | |
var router = express.Router(); | |
const multer = require("multer"); | |
var upload = require("../upload"); | |
router.post("/upload-image", (req, res, next) => { | |
let final_status = 200 | |
upload(req, res, function(err) { | |
if (err instanceof multer.MulterError) { | |
console.log(err) | |
final_status = 500 | |
} else if (err) { | |
console.log(err) | |
final_status = 500 | |
} | |
var paths = req.files.map(file => file.path); | |
console.log("image path: "+paths[0]) | |
}); | |
}); | |
module.exports = router; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment