This is a migrated thread and some comments may be shown as answers.

Chunk upload. Files property.

1 Answer 46 Views
Upload
This is a migrated thread and some comments may be shown as answers.
Mike
Top achievements
Rank 1
Mike asked on 31 Oct 2019, 01:48 PM

We use chunk upload of files to send large files asynchronously with multiple requests.

I want to add custom field to each request (for example File ID) using e.data property.

This custom field has one-to-one relation (file ID <-> file).

 

I found out property -> e.files is Array (A list of the files that will be uploaded).

It means that upload event be triggered for multiple files.

 

I can`t understand cases when this field may contain more than one record (for async mode, using chunks).

On the server side -> request contains such info as chunkIndex, fileName, totalFileSize....

It means: one request for one file.

 

My questions are:

1. When do the upload event may have files property with more than one record?

2. –°an I rely on the fact that "files.length = 1" for async mode using chunks.

3. Is there are any other options to add my custom field (belongs to file) to request?

 

I really hope for your help, thanks.

1 Answer, 1 is accepted

Sort by
0
Accepted
Veselin Tsvetanov
Telerik team
answered on 04 Nov 2019, 08:53 AM

Hi Mike,

Here are the answers to your questions:

1. The files collection in the Upload event handler of the widget will have more than one file only if the async.batch option of the widget is set to true. That, however, does not make any sense at all in chunk upload scenario as it will force the widget to send the entire files together with a single request. Having that said, in the chunk upload scenario, the files collection will always contain one item.

2. Yes, as described above, the files collection will contain only one item.

3. believe that using the e.data property in the Upload event handler is the proper approach for the scenario in question.

I hope that the above explains the case. If you have any other questions, please do not hesitate to contact us.

Regards,
Veselin Tsvetanov
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Upload
Asked by
Mike
Top achievements
Rank 1
Answers by
Veselin Tsvetanov
Telerik team
Share this question
or