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

RadAsyncUpload zip file extension, with maxfilesize

1 Answer 146 Views
This is a migrated thread and some comments may be shown as answers.
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="" %>
<%@ 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"/>   
    <form id="form1" runat="server">
        <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: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) {
                         <span class="allowed-attachments">Select files to upload (<%= String.Join( ",", AsyncUpload1.AllowedFileExtensions ) %>)
                       <label>Attached files:</label>
                        <asp:Repeater runat="server" ID="AttachmentRepeater" EnableViewState="false">
                                <span class="attachment icon-<%#Eval("FileExtension")%>">
                                    <%# Eval("FileName") %>
                                (<%# Eval("ContentLength") %>kb);
Code below

1 Answer, 1 is accepted

Sort by
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.
Asked by
Top achievements
Rank 2
Answers by
Top achievements
Rank 2
Share this question