From 0231a907f0a823277b8dce032956ae5783c7b10b Mon Sep 17 00:00:00 2001 From: Ahmed Maruf Date: Thu, 28 May 2020 16:20:04 +0600 Subject: [PATCH] BE #18 fix relative file path for binaries --- routes/binaries.route.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/routes/binaries.route.js b/routes/binaries.route.js index 08b62c1..1580272 100644 --- a/routes/binaries.route.js +++ b/routes/binaries.route.js @@ -1,12 +1,13 @@ const express = require('express'); const router = express.Router(); const multer = require('multer'); +const path = require('path'); const BinariesController = require('../controllers/binaries.controller'); // configure DiscStorage engine const storage = multer.diskStorage({ - destination: process.env.FS_UPLOAD_IMAGE, + destination: path.join(__dirname + process.env.FS_UPLOAD_IMAGE), filename: function (req, file, cb) { cb(null, file.originalname); } @@ -16,4 +17,4 @@ const upload = multer({storage: storage}); router.post('/images/upload', upload.single('image'), BinariesController.uploadImage); -module.exports = router; \ No newline at end of file +module.exports = router;