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

110
Views
¿Por qué recibo una entrada de archivo vacía después de enviar el formulario?

Hay una función que activa el archivo de entrada y muestra vistas previas:

 $(document).on("change", "#Multifileupload", function() { var MultifileUpload = document.getElementById("Multifileupload"); if (typeof FileReader != "undefined") { var MultidvPreview = document.getElementById("MultidvPreview"); console.log(MultifileUpload.files); var images = Array.prototype.slice.call( MultifileUpload.files, 0, upload_product_images_comment_total ); for ( var i = 0; i < images.length && upload_product_images_comment_loaded <= upload_product_images_comment_total; i++ ) { var file = images[i]; var reader = new FileReader(); reader.onload = function(e) { var img = document.createElement("img"); var span = document.createElement("span"); span.classList.add("remove_image"); span.classList.add("icon-close"); img.src = e.target.result; img.classList.add("Multifileupload_image"); var position = upload_product_images_comment_loaded + 1; if (position > upload_product_images_comment_total - 1) { var li = document.createElement("li"); $(".upload-photo-thumb").hide(); MultidvPreview.prepend(li); MultidvPreview.children[0].appendChild(img); MultidvPreview.children[0].appendChild(span); } else { MultidvPreview.children[position].appendChild(img); MultidvPreview.children[position].appendChild(span); } upload_product_images_comment_loaded++; }; reader.readAsDataURL(file); } MultifileUpload.value = ''; } else { alert("This browser does not support HTML5 FileReader."); } });

La entrada HTML es:

 <input type="file" id="Multifileupload" multiple="" name="file" size="40" accept=".png, .jpg, .jpeg, .gif">

El problema es que cuando elijo algunas imágenes y envío el formulario, obtengo un campo de file vacío en la solicitud:

 csrf_mds_token=b2c47be75606853053acbbcf48c6280c&review=wreewrewrewrwrwrwrwr&rating=5&product_id=6&file=&sys_lang_id=1
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

No puede enviar archivos con el método GET , debe usar POST y agregar enctype="multipart/form-data" a su etiqueta de form :

 <form method="POST" enctype="multipart/form-data">
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!