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

client side detect upload coount?

1 Answer 11 Views
AsyncUpload
This is a migrated thread and some comments may be shown as answers.
randall
Top achievements
Rank 1
randall asked on 15 Apr 2014, 10:55 PM
Hi,
i'm trying to detect the upload count on client side and determine if its 0.
If so i want to enable a panel. I've searched on the forum but cannot find a good example of how to detect upload count.

anyone have an example how to do this?

thanks

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 1
answered on 16 Apr 2014, 03:16 AM
Hi randall,


You can't get the count of the uploaded file from client side. One suggestion is that you can use a global variable and increment it by one in the OnClientFileUploaded event and decrement by one in the OnClientFileUploadRemoved event. Please have a look into the sample code snippet which works fine at my end.

ASPX:
<telerik:RadAsyncUpload ID="RadAsyncUpload1" runat="server" OnClientFileUploaded="OnClientFileUploaded" OnClientFileUploadRemoved="OnClientFileUploadRemoved" MultipleFileSelection="Automatic">
</telerik:RadAsyncUpload>
<telerik:RadButton ID="RadButton1" runat="server" Text="Count" AutoPostBack="false"
    OnClientClicked="UploadedFileCount">
</telerik:RadButton>

JavaScript:
<script type="text/javascript">
    var uploadedFile = 0;
    function OnClientFileUploaded(sender, args) {
        uploadedFile++;
    }
    function OnClientFileUploadRemoved(sender, args) {
        uploadedFile--;
    }
    function UploadedFileCount(sender, args) {
        alert("Uploaded File " + uploadedFile);
    }
</script>

Let me know if you have any concern.
Thanks,
Shinu.
Tags
AsyncUpload
Asked by
randall
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 1
Share this question
or