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

498
Views
Cargue archivos a través de JS a ASP.Net Core con IFormFile

Estoy tratando de enviar un archivo y otros datos a un Asp-Core-BackEnd.

En backendController, leo el archivo como:

 IFormFile file = HttpContext.Request.Form.Files.First(); //don't work HttpContext.Request.Form.TryGetValue("id", out id) //works

Trabajos para otros Clientes. Pero quiero usar la Api con JS.

Mi js-code (reaccionar) se ve así:

 const formData = new FormData(); formData.append('id', 123); formData.append('files', files); //don't work const config = { headers: { 'content-type': 'multipart/form-data; charset=utf-8; boundary="------";' } } await axios.post(url, formData, config);

pero Form.Files es una matriz vacía

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

0

¿Prueba esto?

 [HttpPost] public string getfile([FromForm] string id, [FromForm] IFormFile file) { return "success"; }

ingrese la descripción de la imagen aquí ingrese la descripción de la imagen aquí

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!