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

245
Visualizações
Node js multer send image without update

friends, I am developing a project with node js, I have a form in my hand, in this form I send pictures and texts to the database (MongoDB), there are no problems with them, including uploading images and updating and sending images.

But the user may want to update and send only the articles, and in this case, he may not want to update the picture. I think about this, I want to send the data to the database without updating the picture, I actually did this, but this time I cannot update the picture while it is in the update process, how can I solve this problem? can you help?

Thank you from now.

The code block I did the update process is as follows

const medicine = await Medicine.findOne({ _id: req.params.id });
    medicine.name = req.body.name;
    medicine.price = req.body.price;
    medicine.medicineType = req.body.medicineType;
    medicine.description = req.body.description;

if (req.body.image) {

  medicine.image = '/uploads/' + req.file.filename;

} else if (!req.body.image) {
  
}else{

}

console.log(req.body);
medicine.save();
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