What is the principle of firing uploadProgress event for kendo-upload component?

1 Answer 56 Views
Upload
Yuriy Rogach
Top achievements
Rank 1
Iron
Yuriy Rogach asked on 07 Jun 2023, 01:48 PM

Hello,

I'm using kendo-upload for uploading files and displaying progress by subscribing to the uploadProgress event. 

When [chunkable]="false" it seems that the event is fired every second or less, allowing the developer to show the progress smoothly.

The above is not true when [chunkable] is set to some value, the event is fired only when every next chunk is uploaded. Consider the following settings: [chunkable] = "{ size: 1048576} and file size to upload is 10Mb, in this case, only 10 events are going to be fired with  event.percentComplete = 10, 20, 30 .... 100. This prevents me from building a progress indicator that works smoothly enough. Any ideas about getting uploadProgress fired during the chunk upload more often than once at the end?

1 Answer, 1 is accepted

Sort by
0
Slavena
Telerik team
answered on 12 Jun 2023, 10:46 AM

Hello Yuriy,

Thank you for the provided details.

In general, the chunk upload functionality allows splitting files into chunks and sending them asynchronously through multiple requests to the server. Such approach allows the Upload component to display its progress based on the number of successful chunk uploads:

https://www.telerik.com/kendo-angular-ui/components/uploads/upload/chunk-upload/

By design the uploadProgress event fires for each chunk being uploaded (when chunkable is enabled). When the chunk size is set to a smaller number and the file to be uploaded is bigger in size, the file will be split in more chunks and thus the progress bar.

A possible workaround to customize the progress bar behavior is to utilize the built-in ProgressBar component and nest it in a FileTemplateDirective. The value of the ProgressBar can be set to the value of the percentComplete property emitted by the uploadProgress event of the Upload.

I hope this helps.

Regards,
Slavena
Progress Telerik

As of R2 2023, the default icon type will be SVG instead of Font. See this blogpost for more information.
Yuriy Rogach
Top achievements
Rank 1
Iron
commented on 12 Jun 2023, 03:08 PM

Hello Slavena,

Thanks for the answer!

My issue is related to "By design the uploadProgress event fires for each chunk being uploaded", I would like to get the progress of each chunk upload every some period not after the chunk being uploaded.

Consider the following example: File is about 500 Mb, chunkSize = 50, the connection speed is variable and slow and uploading one chunk takes 10 to 60 seconds. In the worse scenario, during the 60 seconds, no uploadProgress event is fired, and I can't show any progress to the user. In other words, I would like to get uploadProgress event constantly like every second while the chunk is uploading (the same when chunkable is disabled )

Slavena
Telerik team
commented on 15 Jun 2023, 02:59 PM

Hello Yuriy,

Thank you for the additional details. I apologize for the misunderstanding.

The frequency of emitting the uploadProgress event cannot be configured.

I understand that there are some scenarios where the default behavior might not be suitable enough for achieving the specific project requirements. In such cases we try to suggest possible workarounds utilizing the component's API if possible. However, any further custom implementations are considered developer effort as they require custom logic to be implemented to the specific application requirements.

I hope this sheds some light on the matter.

Tags
Upload
Asked by
Yuriy Rogach
Top achievements
Rank 1
Iron
Answers by
Slavena
Telerik team
Share this question
or