From 48d7b4db74186c1a5c29f0d9b3d76792ec47575d Mon Sep 17 00:00:00 2001 From: Yogendra Date: Sun, 17 Nov 2019 17:03:04 +0530 Subject: [PATCH] modified file-uploading conditions --- Routes/files.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Routes/files.js b/Routes/files.js index fd4d6e7..57f9567 100644 --- a/Routes/files.js +++ b/Routes/files.js @@ -34,7 +34,7 @@ module.exports = function(files, knex, jwt, multer, multerS3, aws, path) { function checkFileType(file, cb) { // Allowed ext - const filetypes = /jpeg|jpg|png|gif|pdf/; + const filetypes = /jpeg|jpg|png|pdf/; // Check ext const extname = filetypes.test( path.extname(file.originalname).toLowerCase() @@ -72,7 +72,7 @@ module.exports = function(files, knex, jwt, multer, multerS3, aws, path) { // console.log("authData is here", authData); userId = authData.allData.userId; let fileArray = req.files; - // console.log("length", fileArray); + console.log("length", fileArray); // Save the file name into database const insertions = fileArray.map(file => { @@ -83,7 +83,8 @@ module.exports = function(files, knex, jwt, multer, multerS3, aws, path) { fileLink: file.location, todoId: todoId, userId: userId, - fileName: file.originalname + fileName: file.originalname, + fileType: file.originalname.split('.').pop() }); });