Browse Source

add altText to form-posting

master
Rich Brown 1 year ago
parent
commit
aeea5d6c9d
1 changed files with 4 additions and 2 deletions
  1. +4
    -2
      routes/createRouter.js

+ 4
- 2
routes/createRouter.js View File

@@ -33,9 +33,10 @@ const sanitizedFile = (file) => {
createRouter.post('/form', upload.single('file'), (req, res) => {
const {
file,
body: { title, body, arrayOfTags },
body: {
title, body, arrayOfTags, altText,
},
} = req;
console.log(file);
if (!sanitizedFile(file)) {
return res.status(403).json({ error: 'not an allowed filetype', url: null });
}
@@ -47,6 +48,7 @@ createRouter.post('/form', upload.single('file'), (req, res) => {
name: title,
content: body,
category: tags,
altText,
photo: [fs.createReadStream(file.path)],
},
'multipart',


Loading…
Cancel
Save