File upload component, loading too slow

Hello guys, I want to upload file to sharepoint across an API I have created, already achieve that but it's too slow.

I use the following build-in file upload component, and when the file is parsed, It execute the sharepoint upload REST APi, where I pass the file cotent as base64string

the problem is the component spend like 15 second to parse a 6MB file, it's too slow. How can I make it faster?

I have tried without parsing the file, the event as when change, but the file was uploaded incomplete

My REST API query:
image
Where I pass the base64string and the name, I think the base64 isn't complete if I don't parse it.

Hey @Zheng - thanks for reaching out.

I tested this on my end by logging both the onChange and onParse events and it took less than a second to parse a ~20MB file. The computer I use is fairly powerful, though, and the parsing operation does run client-side. It's possible that the slowdown you're seeing is due to hardware limitations.

Can you let me know if you're still experiencing this issue and, if so, if you notice any difference when accessing the app on a different machine?

1 Like

Hi Darren, thanks for the reply,

Yes, the problem was solved, What I did was.. insted of upload and parsing 1 file at the time, I tried to proccess multiple files at same time, and magically it spend less time... I don't know why but it works for me :joy:

image
I have a js, and for each file selected by user, call the uploadFileSharepoint EndPoint.
And the uploadButton setting, just changed to allow multiple file selection:
image

Thanks

Ah I didn't catch the fact that you were needing to process multiple files. :+1: It makes some sense that your overall workload would be faster doing it this way, but I don't know why individual files would be processed more quickly.

Looking back at your original post, I also want to mention that it shouldn't be necessary to parse the files unless you are actively utilizing the contained data in your app. That particular option shouldn't have any affect on the base64Data.

Regardless, I'm glad it's working for you!

If I don't parse the file, it would be corrupted. I upload the file to Sharepoint by APi, and without parsing, I cannot open the fiel, it shows like the file content is wrong.
I think it is beacause the file content(base64string) isn't completely loaded in the component and I have pass the content to the API before the content is completely loaded

1 Like