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

320
Views
Cómo imprimir el orden de entrada múltiple "Nombre de archivo" en html y JS

Tengo cinco archivos scan.pdf, "1_PVC", "2_Graham", 3_TAC, "4_TEC", quiero que console.log pueda imprimir recuperar exactamente la misma cadena ("scan" "1_PVC" "2_Graham" 3_TAC "4_TEC") dentro del nombre del archivo. No importa cómo lo obtenga, eventualmente lo obtendrá del orden alfabético "1_PVC"... Esto es lo que he hecho hasta ahora.

 <input type="file" name="filess[]" id="file" accept=".pdf" multiple="multiple" /> var filess = event.target.files; console.log(filess); var count = files.length; for (var k=0; k<file.files.length; ++k){ console.log(files[i].name + "\n"); }

ingrese la descripción de la imagen aquí

Cualquier método puedo imprimir el "Nombre de archivo:" según la selección del usuario.

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

0

¿Es esto lo que estás buscando?

 <!doctype html> <html> <head> <meta charset='utf-8' /> <script> function logFiles(){ var list=document.getElementById('filesElement').files; var listlen=list.length; for (var filenum=0;filenum<listlen;filenum++){ console.log(list[filenum].name); } } </script> </head> <body> <input type='file' id='filesElement' multiple='multiple' onchange='logFiles();' /> </body> </html>
about 4 years ago · Juan Pablo Isaza Report

0

Intente usar la API de FilePicker (ya que conserva el orden de la selección):

 const fileHandles = await window.showOpenFilePicker({multiple: true}); console.log(fileHandles.map(fh => fh.name));

También puede leer y escribir archivos locales mediante la API de FileSystem. https://developer.mozilla.org/en-US/docs/Web/API/FileSystem Aunque FilePicker solo funciona en Edge y Chrome atm: https://developer.mozilla.org/en-US/docs/Web/ API/Ventana/showOpenFilePicker

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!