Open Mjashwanthh opened 1 year ago
use this it will work also u need to create a folder as same as this folder: "music-image", where all the files will be stored then u will get your data
const profilePicture = req.body.file
const user = await User.findById(req.user._id)
const myCloud = await cloudinary.v2.uploader.upload(profilePicture, {
folder: "music-image",
resource_type: "auto",
})
user.profilePicture.public_id = myCloud.public_id
user.profilePicture.url = myCloud.url
await user.save()
const result = await cloudinary.v2.uploader.upload(req.file.path,{ public_id:
${user._id}_profile
, width: 500, height: 500, crop: 'fill', });