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

Get size in client validation failed

3 Answers 29 Views
AsyncUpload
This is a migrated thread and some comments may be shown as answers.
Tia
Top achievements
Rank 1
Tia asked on 10 Sep 2013, 02:28 PM
Hello support,

Is there any way I can get the file size in client validation failed client event?

Thanks
Tia

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 1
answered on 10 Sep 2013, 02:52 PM
Hi Tia,

With Upload Modules other than File Api, it is not possible to get the uploaded file size in the OnClientValidationFailed event. Suppose you are using the File Api Upload Module, then you can get the file size using jQuery as follows.

JavaScript:
<script type="text/javascript">
    function OnClientValidationFailed(sender, args) {
        var jQueryRowObject = $telerik.$(args.get_row());
        alert(jQueryRowObject.find("input")[0].files[0].size);
    }
</script>

Thanks,
Shinu.
0
Tia
Top achievements
Rank 1
answered on 10 Sep 2013, 05:21 PM
I can disable the other modules. Thanks for answering me shinu. I need another help. I am using asyncupload to upload large files. How can I display the progress like 10%, 50% completed ? I dont need any separate controls such as progressarea.
0
Shinu
Top achievements
Rank 1
answered on 11 Sep 2013, 03:57 AM
Hi Tia,

You can use the OnClientProgressUpdating client event of the RadAsyncUpload to achieve your requirement. Please have a look at the sample code I tried which works fine at my end.

ASPX:
<telerik:RadAsyncUpload ID="RadAsyncUpload1" runat="server" OnClientProgressUpdating="OnClientProgressUpdating"
    OnClientFilesUploaded="OnClientFilesUploaded" TargetFolder="~/User/Uploads/" MaxFileSize="579371152"
    MultipleFileSelection="Automatic" UploadedFilesRendering="BelowFileInput">
</telerik:RadAsyncUpload>
<br />
<asp:Label ID="Label1" runat="server">
</asp:Label>

JavaScript:
<script type="text/javascript">
    function OnClientFilesUploaded(sender, args) {
        document.getElementById("Label1").innerHTML = "Uploads Completed";
 
    }
    function OnClientProgressUpdating(sender, args) {
        var data = args.get_data();
        var percents = data.percent;
        document.getElementById("Label1").innerHTML = "Completed : " + percents.toString() + "%";
    }
</script>

Thanks,
Shinu.
Tags
AsyncUpload
Asked by
Tia
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 1
Tia
Top achievements
Rank 1
Share this question
or