diff --git a/controllers/directoryController.js b/controllers/directoryController.js index 88f0af0..2b2e31e 100644 --- a/controllers/directoryController.js +++ b/controllers/directoryController.js @@ -3,15 +3,16 @@ import cloudinary from "cloudinary"; export const createDirectory = async (req, res) => { try { - let image; - // console.log(req.files) - if (req.files !== null) { + let images; + // console.log(req.body) + // console.log(req.files.image) + if (req.files) { const files = req.files.image; const myCloud = await cloudinary.uploader.upload(files.tempFilePath, { folder: "cmp/image", }, function (error, result) { (result, error) }); - image = { + images = { public_id: myCloud.public_id, url: myCloud.secure_url, } @@ -32,7 +33,6 @@ export const createDirectory = async (req, res) => { FacebookUrl, InstagramUrl, } = req.body; - // console.log(req.body) const data = await directoryModel.create({ name, @@ -49,7 +49,7 @@ export const createDirectory = async (req, res) => { LinkedinUrl, FacebookUrl, InstagramUrl, - image: image + image: images }); res.status(201).json({ diff --git a/tmp/tmp-1-1654878203409 b/tmp/tmp-1-1654878203409 new file mode 100644 index 0000000..62743be Binary files /dev/null and b/tmp/tmp-1-1654878203409 differ diff --git a/tmp/tmp-1-1654878668365 b/tmp/tmp-1-1654878668365 new file mode 100644 index 0000000..62743be Binary files /dev/null and b/tmp/tmp-1-1654878668365 differ diff --git a/tmp/tmp-1-1654879240003 b/tmp/tmp-1-1654879240003 new file mode 100644 index 0000000..62743be Binary files /dev/null and b/tmp/tmp-1-1654879240003 differ diff --git a/tmp/tmp-1-1654879315699 b/tmp/tmp-1-1654879315699 new file mode 100644 index 0000000..62743be Binary files /dev/null and b/tmp/tmp-1-1654879315699 differ diff --git a/tmp/tmp-1-1654879381712 b/tmp/tmp-1-1654879381712 new file mode 100644 index 0000000..62743be Binary files /dev/null and b/tmp/tmp-1-1654879381712 differ diff --git a/tmp/tmp-1-1654879478391 b/tmp/tmp-1-1654879478391 new file mode 100644 index 0000000..62743be Binary files /dev/null and b/tmp/tmp-1-1654879478391 differ diff --git a/tmp/tmp-1-1654879780998 b/tmp/tmp-1-1654879780998 new file mode 100644 index 0000000..62743be Binary files /dev/null and b/tmp/tmp-1-1654879780998 differ diff --git a/tmp/tmp-2-1654878217852 b/tmp/tmp-2-1654878217852 new file mode 100644 index 0000000..62743be Binary files /dev/null and b/tmp/tmp-2-1654878217852 differ diff --git a/tmp/tmp-2-1654878672959 b/tmp/tmp-2-1654878672959 new file mode 100644 index 0000000..62743be Binary files /dev/null and b/tmp/tmp-2-1654878672959 differ