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

Get selected files details

3 Answers 55 Views
AsyncUpload
This is a migrated thread and some comments may be shown as answers.
Jayzle
Top achievements
Rank 1
Jayzle asked on 19 Aug 2015, 07:55 AM
<telerik:RadAsyncUpload runat="server" ID="radUpload" MultipleFileSelection="Automatic" ManualUpload="true" HideFileInput="true" Localization-Select="Select files ..." EnableFileInputSkinning="true" OnClientFilesSelected="onFilesSelected"></telerik:RadAsyncUpload>

 

Hi,

 Based on above code, just want to ask how to loop through selected files to get the row and size? Please take note that ManualUpload is set to true.

Basically I want to have below piece of code (but this was created for OnClientFileSelected)

args.get_fileInputField().files[0].size;
 
var row = args.get_row();               
$(row).addClass("file-row");

3 Answers, 1 is accepted

Sort by
0
Aneliya Petkova
Telerik team
answered on 20 Aug 2015, 02:57 PM
Hi Jayzle,

Using get_fileInputField() method of the OnClientFileSelected event is the only way to get the file size on the client-side before the upload. You can use it to store the selected files' sizes in an array.

Regards,
Aneliya Petkova
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Jayzle
Top achievements
Rank 1
answered on 21 Aug 2015, 01:02 AM

What's the process if I select multiple files but I only have OnClientFileSelected event (not OnClientFilesSelected)? Do I need to loop or event will run for each file?

 

Kindly confirm, getting file size in client will only work for HTML5 browsers? Thanks.

0
Aneliya Petkova
Telerik team
answered on 21 Aug 2015, 08:06 AM
Hello Jayzle,

Straight to your questions:
1. Yes, the event will be fired for each file, which is selected by the user.

2. Yes, you will be able to find the size of each selected file in OnClientFileSelected event only in the modern browsers. In IE <= 9, args.get_fileInputField().files[0] will not be available and it will throw an error(but the event will fire).

Regards,
Aneliya Petkova
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
AsyncUpload
Asked by
Jayzle
Top achievements
Rank 1
Answers by
Aneliya Petkova
Telerik team
Jayzle
Top achievements
Rank 1
Share this question
or