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

349
Views
¿Cómo aceptar solo el archivo apk en reaccionar js?
import React from "react"; export default function DropDown() { const changeHandler=()=>{ let value=document.getElementById('someId'); let ext = value.match(/\.([^\.]+)$/)[1]; switch (ext) { case 'apk': alert('Allowed'); break; default: alert('Not allowed'); value = ''; } }; return ( <> <input type="file" id="someId" accept=".apk" onChange={changeHandler} /> </> ); }

después de seleccionar el archivo, arroja un valor de error. Match no es una función. cómo resolver eso si hacemos clic en el botón de carga si cargamos el archivo apk, la ventana emergente arroja permitir o, de lo contrario, no se permite la ventana emergente

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

0

La propiedad accept=".apk" en primer lugar, si es compatible con el navegador, no permitiría archivos que no .apk .

Si realmente desea obtener el nombre de archivo real con la extensión, el controlador de eventos pasa un objeto de evento. Solo necesita acceder al objetivo de ese evento en su controlador de cambios.

 const changeHandler=(e)=>{ const filename = e.target.files[0].name; // filename.apk // do whatever you want. }

también puede usar e.target.files[0].type también mostrará qué tipo de nombre de archivo se eligió.

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!