make it bettersl

This commit is contained in:
pawan-dot 2022-06-10 21:47:51 +05:30
parent 32265adb3c
commit ff8e0f12b7
7 changed files with 14 additions and 11 deletions

View File

@ -3,13 +3,19 @@ import cloudinary from "cloudinary";
export const createDirectory = async (req, res) => { export const createDirectory = async (req, res) => {
try { try {
const files = req.files.image; let image;
// console.log(req.body) // console.log(req.files)
// console.log(files) if (req.files !== null) {
const myCloud = await cloudinary.uploader.upload(files.tempFilePath, { const files = req.files.image;
folder: "cmp/image", const myCloud = await cloudinary.uploader.upload(files.tempFilePath, {
}, folder: "cmp/image",
function (error, result) { (result, error) }); },
function (error, result) { (result, error) });
image = {
public_id: myCloud.public_id,
url: myCloud.secure_url,
}
}
const { const {
name, name,
phone, phone,
@ -43,10 +49,7 @@ export const createDirectory = async (req, res) => {
LinkedinUrl, LinkedinUrl,
FacebookUrl, FacebookUrl,
InstagramUrl, InstagramUrl,
image: { image: image
public_id: myCloud.public_id,
url: myCloud.secure_url,
},
}); });
res.status(201).json({ res.status(201).json({

BIN
tmp/tmp-1-1654869231487 Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

BIN
tmp/tmp-1-1654869330605 Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

BIN
tmp/tmp-1-1654875653394 Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

BIN
tmp/tmp-1-1654875744407 Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

BIN
tmp/tmp-1-1654876070898 Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

BIN
tmp/tmp-1-1654877661934 Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB