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

File to upload

2 Answers 44 Views
Upload (Obsolete)
This is a migrated thread and some comments may be shown as answers.
John Smith
Top achievements
Rank 1
John Smith asked on 11 Dec 2010, 02:37 AM
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 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 13 Dec 2010, 08:59 AM
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.
0
John Smith
Top achievements
Rank 1
answered on 03 Jan 2011, 03:34 AM
Thank you.
Tags
Upload (Obsolete)
Asked by
John Smith
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
John Smith
Top achievements
Rank 1
Share this question
or