Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

243
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!