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

RadAsyncUpload zip file extension, with maxfilesize

1 Answer 59 Views
AsyncUpload
This is a migrated thread and some comments may be shown as answers.
Joel
Top achievements
Rank 2
Joel asked on 08 Oct 2015, 03:35 PM

I get a failure from OnClientFileUploadFailed when I allow zip files, and MaxFileSize is set.  If I remove MaxFileSize zip files upload correctly, but I would like to have both.  Is there a workaround for this?

 

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="mu.aspx.cs" Inherits="CODAUploads.mu" %>
 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
 
<!DOCTYPE html>
 
<head runat="server">
     <meta charset="utf-8" />
      <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title><%: Page.Title %></title>
        <link rel="stylesheet" href="~/content/bootstrap.css"/>   
</head>
<body>
    <form id="form1" runat="server">
    <div>
 
        <telerik:RadScriptManager runat="server" ID="rsm"></telerik:RadScriptManager>
 
 
 
<asp:Panel ID="pnlUpload" runat="server">
    <telerik:RadAsyncUpload runat="server" ID="AsyncUpload1" OnClientFileUploaded="OnClientFileUploaded" OnClientFileUploadFailed="badfiletype" OnClientValidationFailed="badfiletype"
        AllowedFileExtensions="zip,xlsx,xls,pdf,doc,docx" MaxFileSize="2048576" OnFileUploaded="AsyncUpload1_FileUploaded" Skin="Bootstrap" UploadedFilesRendering="BelowFileInput">
        </telerik:RadAsyncUpload>
 
     <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
        <script type="text/javascript">
            var uploadedFilesCount = 0;
            var isEditMode;
            function validateRadUpload(source, e) {
 
                if (isEditMode == null || isEditMode == undefined) {
                    e.IsValid = false;
 
                    if (uploadedFilesCount > 0) {
                        e.IsValid = true;
                    }
                }
                isEditMode = null;
            }
 
            function badfiletype(sender, eventArgs) {
                alert("This file type is not accepted");
            }
 
 
            function OnClientFileUploaded(sender, eventArgs) {
                uploadedFilesCount++;
            }          
              
        </script>
    </telerik:RadCodeBlock>
                         <span class="allowed-attachments">Select files to upload (<%= String.Join( ",", AsyncUpload1.AllowedFileExtensions ) %>)
                        </span>
                    
                       <label>Attached files:</label>
                        <asp:Repeater runat="server" ID="AttachmentRepeater" EnableViewState="false">
                            <ItemTemplate>
                                <span class="attachment icon-<%#Eval("FileExtension")%>">
                                    <%# Eval("FileName") %>
                                (<%# Eval("ContentLength") %>kb);
                                </span>
                            </ItemTemplate>
                        </asp:Repeater>
 
 
</asp:Panel>
 
    </div>
    </form>
</body>
</html>
Code below

1 Answer, 1 is accepted

Sort by
0
Joel
Top achievements
Rank 2
answered on 08 Oct 2015, 03:40 PM
Never mind.  Please remove this thread.  I thought MaxFileSize was in KB.  The zip file was 3mb.
Tags
AsyncUpload
Asked by
Joel
Top achievements
Rank 2
Answers by
Joel
Top achievements
Rank 2
Share this question
or