Client-Side programming with RadAsyncUpload

4 posts, 0 answers
  1. ELTON
    ELTON avatar
    2 posts
    Member since:
    Nov 2011

    Posted 12 May 2014 Link to this post

    May I use client-side api to set  MultipleFileSelection, AllowedFileExtensions, MaxFileSize  ??
  2. Aneliya Petkova
    Aneliya Petkova avatar
    207 posts

    Posted 14 May 2014 Link to this post

    Hi Elton,

    You can change the allowed file extensions of the RadAsyncUpload on the client using set_allowedFileExtensions property:
    var upload = $find('RadAsyncUpload1');

    RadAsyncUpload has no client-side properties for MultipleFileSelection and MaxFileSize.

    Aneliya Petkova

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

  3. DevCraft R3 2016 release webinar banner
  4. upasana
    upasana avatar
    3 posts
    Member since:
    Nov 2015

    Posted 10 Dec 2015 in reply to Aneliya Petkova Link to this post

    Hello Team,

    var upload = $find('RadAsyncUpload1');

    its not working for me its giving error on setting the extension.

    Here is my code:-

    function OnClientValidationFailed(sender, args) {
            var $row = $(args.get_row());
            var erorMessage = getErrorMessage(sender, args);
            if (erorMessage != undefined) {
                var span = createError(erorMessage);

        function getErrorMessage(sender, args) {
            var fileExtention = args.get_fileName().substring(args.get_fileName().lastIndexOf('.') + 1, args.get_fileName().length);
            if (args.get_fileName().lastIndexOf('.') != -1) {//this checks if the extension is correct
                    return ("Invalid file type");
            else {
                return ("not correct extension.");

        function createError(erorMessage) {
            var input = '<span class="ruErrorMessage">' + erorMessage + ' </span>';
            return input;

      function OnClientFileUploading(sender, args) {
            var fileExtention = args.get_fileName().substring(args.get_fileName().lastIndexOf('.') + 1, args.get_fileName().length);
            var upload =("FileUpload");
            upload.set_allowedFileExtensions("." + fileExtention);

    <telerik:RadAsyncUpload ID="FileUpload" runat="server" OnFileUploaded="Upload_FileUploaded"  OnClientValidationFailed="OnClientValidationFailed" OnClientFileUploading="OnClientFileUploading">

    The extension which I want to  set is dynamic like 354647.F01,977543.F08 only "F" will be common in the i m not able to set it through "AllowedFilesExtensions" property.

    And "OnClientValidationFailed" property is not working with setting "AllowedFilesExtensions" property.

    so please help me this. or suggest me  if there is any other way to do this.

    Please reply ASAP.

  5. Ivan Danchev
    Ivan Danchev avatar
    788 posts

    Posted 15 Dec 2015 Link to this post

    Hello Upasana,

    The js error you are getting is because of the following line in your OnClientFileUploading handler:
    var upload =("FileUpload");

    It has to be changed as follows, so that the "upload" variable holds a reference to the AsyncUpload object:
    var upload = $find("FileUpload");
    var upload = sender;

    Ivan Danchev
    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