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

305
Views
¿Cómo mostrar la respuesta en la página?
... index.html <body> <h1>upload test</h1> <!--<form method="post" enctype="multipart/form-data" action="/picture"> --> <form id="pictureForm" method="post" enctype="multipart/form-data"> <div> <label for="file">Choose file to upload</label> <input type="file" name="file" id="pictureFile" multiple> </div> <div> <button>Submit</button> </div> </form> <script src="https://unpkg.com/axios/dist/axios.min.js"></script> <script src="./upload.js"></script> </body> ...
 upload.js ... await axios({ method: 'post', url: '/upload', data: formData, headers: { 'Content-Type': 'multipart/form-data', }, }) ...
 server.js ... app.get('/', async (req, res, next) => { try { res.writeHead(200, { 'Content-Type': 'text/html' }); const data = await fs.readFile('../index.html') res.write('Hello nodejs'); res.end(data); next(); } catch (err) { console.error(err); } }); app.post('/upload', upload.single('file'), async (req, res, next) => { try { res.send('work'); <-- not working } }); ...

Estoy haciendo un servidor de carga de imágenes. y yo éxito. puedo cargar la imagen en el directorio particular que quiero.

el problema es que quiero ver la frase 'éxito' usando res.end() (o res.send, etc.). ¡pero la página web no cambió!

ingrese la descripción de la imagen aquí

correctamente, la web obtuvo la respuesta. pero no sé cómo mostrar esta respuesta en la página.

por favor enséñame.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

En la interfaz puedes hacer algo como esto

 fetch("http://localhost:5500/upload", requestOptions).then(response => response.text())
about 4 years ago · Juan Pablo Isaza Report
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!