Skip to content

Commit

Permalink
modified file-uploading conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
Yogendra committed Nov 17, 2019
1 parent e9e6c8a commit 48d7b4d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions Routes/files.js
Expand Up @@ -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()
Expand Down Expand Up @@ -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 => {
Expand All @@ -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()
});
});

Expand Down

0 comments on commit 48d7b4d

Please sign in to comment.