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

190
Views
Cargar archivo no me permite elegir el mismo archivo después de eliminarlo de la selección en reaccionar

en reaccionar cuando borramos el archivo haciendo clic en el botón de cruz, no podemos seleccionar el mismo archivo. Cómo escribir la función que después de eliminar el archivo existente si el usuario desea volver a seleccionar el mismo archivo, no se debe seleccionar el archivo. Si desea seleccionar en lugar del archivo existente, se debe seleccionar el archivo.

 import React from "react"; export default function DropDown() { const [checked, setChecked] = React.useState(false); function fun(e) { let file=e.target.files[0]; localStorage.setItem("selectedFile",file.name); if (localStorage.getItem("selectedFile")===file.name) { alert('duplicate'); // document.getElementById("file").value = ''; //setChecked(false); } else { alert('not duplicate'); //setChecked(true); } console.log(localStorage.selectedFile); } return ( <div > <input type="file" id="file" onChange={(e) => {setChecked(true);fun(e)}} /> {checked ?<button onClick={(e)=>{setChecked(false);document.getElementById("file").value = '';}}>x</button>:null} </div> ); }
about 4 years ago · Juan Pablo Isaza
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!