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

77
Views
Uploading a large number of files at once

how to implement on react uploading a large number of files at a time?

i specified in input multiplu it seems to work but still does not allow to upload more than 1 file at a time

const [fileLoad, setLoadFileState] = useState(false);
const [imageState, setImageState] = useState(false);
const [image, setImage] = useState<any>([]);

const refLabel = useRef<HTMLLabelElement>(null);
const openFile = () => refLabel.current?.click();
const uploadFile = () => {}

const changeHandler = async (event: React.ChangeEvent<HTMLInputElement>) => {
    filePromiseAll(event)
    .then((data) =>{
        console.log(data)
    })
}

const filePromiseAll = async (event: React.ChangeEvent<HTMLInputElement>) => {
    
    const filePromise:any = new Promise((resolve) => {
        if(!event.target.files?.length)
            return;
            
        const files = Array.from(event.target.files);
        files.forEach(file => {
            if(!file.type.match('image'))
                return;

            const reader = new FileReader();
            reader.onload = (ev: ProgressEvent<FileReader>) => {

                if(ev.target)
                    resolve(ev.target.result);
            }
            reader.readAsDataURL(file);
        })

    })


    return await Promise.all(filePromise);
    
}
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!