Selvi Jp

Selvi Jp

  • NA
  • 23
  • 4.1k

Upload mulitple files in react post request

Aug 9 2022 7:19 AM

HI,

I can achecive mulitple file upload at a time.but if the file size is large axios error will appear.so i want to send file one by one.

if first file send then only second file upload again.so i am using while loop for acheive this.but its not working. this is my code.

let i = 0;

while (i < finalupload.length) {
  console.log(finalupload.length);
  formData.append("PDFName", finalupload[i]);
  axios
    .post(`${BASE_URL}Upload/UploadPDF`, formData, {
      })
    .then((response) => {
      console.log(response);     

      i++;
    });
}
finalaplod is mulitple selected filereader.