Chunk Upload Results in Failure
Hello Syncfusion,
I am using the `Syncfusion.Blazor.Inputs.SfUploader` control and uploads work great if the sizes are under the chunk limit (1MB). However, if a larger file is uploaded it results in a "File failed to upload" message and the chunkfailure handler is called with a 401 error code (unauthorized).
I did find this documentation:
And while I am using a Blazor server-side application, the API application it is calling is not (regular ASP.NET API application).
I would greatly appreciate any pointers on why smaller (non-chunk) uploads work but smaller (chunked) files do not.
Thank you for all your great work out there!
Hi Mike-E,
Thank you for reaching out to us! We truly appreciate your time in bringing this to our attention.
We have created a sample to replicate the behavior you described. However, we were unable to reproduce the issue on our end. Large file is uploaded properly in chunk upload.
For your reference, we have attached the sample along with a video demonstration that illustrates the expected behavior.
To better assist you in resolving this issue, we kindly request the following:
- The full page code snippet showing how you are render the uploader component and controller part
- If possible, a video recording of the problem you are experiencing so we can better understand the issue and investigate further.
We sincerely appreciate your understanding and cooperation in helping us troubleshoot this. Your input will help us provide the most accurate solution.
Thank you again for your patience, and we look forward to hearing from you soon!
Regards,
Priyanka K
Attachment: BlazorUploadAndDownload_dfb92593.zip
Hi @Priyanka,
Thank you for your investigation and for taking the time to provide a demonstration.
Please be aware that my implementation uses authorization and sends a Authorization: Bearer header:
For full (non-chunked files) the bearer is sent:
However, for chunked files, the bearer is not sent:
Ah! I found out this is occurring in FireFox and not Edge/Chrome. 🤯
Edge/Chromium sends the Bearer header, but FireFox does not. Was there a change in how FireFox handles xhr requests lately?
Hi Mike-E,
Thank you for the update. We've noted that when setting currentRequest within the FileSelected event, it applies only to the first request and does not persist in subsequent chunked requests. To ensure currentRequest is passed with each chunk, please set it within the OnChunkUploadStart event. Additionally, we have verified that custom headers are sent to the server consistently across all specified browsers. Please find the code snippet and sample provided below for reference:
<SfUploader ID="UploadFiles"> private void SelectedHandler(SelectedEventArgs args) |
If you continue to encounter the issue, please feel free to share a runnable sample and the steps to reproduce the issue for further assistance.
Regards,
Priyanka K
Attachment: ChunkUpload_f0423cd8.zip
That was it @Priyanka! Thank you very much for that pointer. I was setting the form + request on the file selection. For some reason that was propagating to the OnStart method for Chrome/Edge but not FireFox. Moving the form + request assignment as you suggest to the OnStart fixes the problem for all browsers. Thank you so very much for supporting your product so well! 🙏
Hi Mike-E,
We are glad that the reported issue has been resolved on your end. Please reach out to us if you require any additional assistance.
Regards,
Priyanka K