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

Limiting the number of files.

1 Answer 47 Views
AsyncUpload
This is a migrated thread and some comments may be shown as answers.
Berkman
Top achievements
Rank 1
Berkman asked on 16 Apr 2013, 09:07 AM
Hi,

The RadUpload control I am using is intended to upload only three files at a time. If the user select more than three files and try to upload, I want to show an alert. How?

Thankyou,
Berk

1 Answer, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 16 Apr 2013, 09:42 AM
Hi,

You can use JavaScript to check the selected number of files against a constant. Please have a look at the following code.

JavaScript:
<script type="text/javascript">
    function OnClientFilesSelected(sender, eventArgs) {
        if (eventArgs.get_count() > 3) {
            // eventArgs.set_cancel('true') cancels the upload and no files are sent to the server
            eventArgs.set_cancel(true);
            // alert the user that they have selected too many files
            alert("Select a maximum of 3 files");
        }
    }
</script>

Thanks,
Princy.
Tags
AsyncUpload
Asked by
Berkman
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or