Hi pbwbart,
Please try the example below
- <%@ Page Language="C#" %>
-
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-
- <script runat="server">
-
- protected void attachment1_AttachmentRemoveClicked(object sender, AttachmentItemEventArgs args)
- {
-
- hfTotalSize.Value=(int.Parse(hfTotalSize.Value)-args.Item.FileSize).ToString();
- }
- </script>
-
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head runat="server">
- <title>Untitled Page</title>
- </head>
- <body>
- <form id="form1" runat="server">
- <CuteWebUI:UploadAttachments ID="attachment1" runat="server" OnAttachmentRemoveClicked="attachment1_AttachmentRemoveClicked">
- </CuteWebUI:UploadAttachments>
- <asp:HiddenField ID="hfTotalSize" runat="server" Value="0" />
- </form>
- </body>
- </html>
-
- <script>
- var totalSize = document.getElementById("<%=hfTotalSize.ClientID %>");;
-
- var MaxSizeKB=1024000;
- function CuteWebUI_AjaxUploader_OnSelect(files) {
-
- for (var i = 0; i < files.length; i++) {
- totalSize.value = parseInt(totalSize.value) + files[i].FileSize;
- }
-
- if (parseInt(totalSize.value) > MaxSizeKB) {
- for (var j = 0; j < files.length; j++) {
- totalSize.value = parseInt(totalSize.value) - files[j].FileSize;
- }
-
- alert("File size limit exceeded");
- return false;
- }
-
- }
- </script>
Regards,
Ken