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>
<
html
xmlns
=
"http://www.w3.org/1999/xhtml"
>
<
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
>