Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

173
Visualizações
I am not able to upload image on the cloudinary using mern stack

Here is the source code github of my current project which i am working i belive i might doing something very stupid i cant figure whats that The main issue in my life is i am getting the image in my backend but while uploading my server just crash Here is my function registerUser Whose Purpose to life is get data and put it in database and upload image on the cloudinary as you can see i am consoling log name and avatar which proves i am getting data in my function perfectly the line const myCloud = await cloudinary.v2.uploader.upload(req.body.avatar, { folder: "avatars", width: 150, crop: "scale", }); is crashing server

exports.registerUser = catchAsyncErrors( async(req,res,next)=>{
  console.log("The file is ",req.body.name);
  console.log("The cloudinary function is ",req.body.avatar);
  const myCloud = await cloudinary.v2.uploader.upload(req.body.avatar, {
    folder: "avatars",
    width: 150,
    crop: "scale",
  });
    console.log("The value of my cloud is",myCloud)
    const {name,email,password} = req.body;
    
    const user = await User.create({
        name,email,password,
        avatar:{
            public_id:myCloud.public_id,
            url:myCloud.secure_url,
            // public_id:"This is the public id",
            // url:"THis is url",
        }
    });
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda