Get selected files details

4 posts, 0 answers
  1. Jayzle
    Jayzle avatar
    28 posts
    Member since:
    Dec 2012

    Posted 19 Aug 2015 Link to this post

    <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");

  2. Aneliya Petkova
    Admin
    Aneliya Petkova avatar
    207 posts

    Posted 20 Aug 2015 Link to this post

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Jayzle
    Jayzle avatar
    28 posts
    Member since:
    Dec 2012

    Posted 20 Aug 2015 in reply to Aneliya Petkova Link to this post

    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.

  5. Aneliya Petkova
    Admin
    Aneliya Petkova avatar
    207 posts

    Posted 21 Aug 2015 Link to this post

    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
Back to Top