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

251
Views
Ant Design upload component - enable sending multiple files in single request

I am using ant design upload component to upload multiple files to the server.

const props = {
    multiple: true,
    showUploadList: false,
    beforeUpload: () => {
        return false              
    },
    onChange: (info: any) => {
        console.log(info)
        setAttachmentLoader(true)
        info.fileList.forEach((file: any) => {
            formData.append("upload2[]", file.originFileObj)
        })
        formData.append("_charset_", "UTF-8")
        formData.append("upload2-data", "")
        uploadApiFunction(formData, (res: any) => {
            setAttachmentLoader(false)
            res.text && message.success(res?.text, 4)
        }, (err: any) => { console.log(err); setAttachmentLoader(false) })
    },
};

            <Upload {...props} fileList={[]}>
                <PrimaryButton text="Add attachment" />
            </Upload>

The api is getting called for each file when I upload multiple files. I want all the selected files should get uploaded to the server in a one single request.

Can anyone help me ?

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

0

onChange is called every time when the list of files changes, you need to transfer onChange call to another button as shown in the documentation

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!