File to upload

Thread is closed for posting
3 posts, 1 answers
  1. John Smith
    John Smith avatar
    11 posts
    Member since:
    Oct 2009

    Posted 10 Dec 2010 Link to this post

    I'm trying to use $find('<%= RadUpload1.ClientID %>').getFileInputs().length to identify the number of files the user has selected I run into the problem that when no files are selected the value appears to be 1.

    Is there something I'm missing?

    Thanks
  2. Answer
    Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 13 Dec 2010 Link to this post

    Hello,


    Iterate through the upload controls and check for whether a file is selected to get the actual selected file count.

    Client code:
    <script type="text/javascript">
        function getFileCount() {
            var ul = $find('<%= RadUpload1.ClientID %>');
            var inputs = ul.getFileInputs();
            var count = 0;
            for (i = 0; i < inputs.length; i++) {
                if (inputs[i].value!="")
                    count++;
            }
            alert(count); // show count
        }
    </script>



    -Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. John Smith
    John Smith avatar
    11 posts
    Member since:
    Oct 2009

    Posted 02 Jan 2011 Link to this post

    Thank you.
Back to Top