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

167
Views
Cómo parchear un archivo de usuario que contiene archivos como imagen o archivo txt
router.patch ('/:id', upload.single ('profilePic'), async (req, res) => { try { // const prevUser = await User.findById (req.params.id).lean ().exec (); // const prevPath = prevUser.profile_pic; //delete prevfile using prevPath. const del = await User.findById ({_id: req.params.id}, function ( err, data ) { console.log (data); if (err) throw err; fs.unlink (data.profile_pic); }); console.log (del); const newUser = await User.findByIdAndUpdate ({ _id: req.params.id, first_name: req.body.first_name, last_name: req.body.last_name, profile_pic: req.file.path, }); return res.status (201).send ({newUser}); } catch (e) { return res.status (500).send ({message: e.message, status: 'Failed'}); } });
  1. Quiero actualizar este archivo y agregar una foto de perfil diferente, no sé cómo actualizarlo, ya que es un formulario de datos, mientras actualizo el nuevo perfil, quiero desvincular el anterior.
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!