100Mo limit size

3 posts, 1 answers
  1. CHOVA
    CHOVA avatar
    4 posts
    Member since:
    Jul 2010

    Posted 06 Feb 2011 Link to this post

    Hi All,

    I have an error when i try to upload a file size greater than 100Mo !. I don't understand if this error come from IIS or AsyncUpload ?
    I do my test on my local machine with IIS 7.5 (Windows 7 Ultimate) and on my server with IIS 7.5 (windows 2008 R2 DataCenter) and i have the same error.

    My web.config :
    <security><requestLimits maxAllowedContentLength="314572800" /></requestFiltering></security>

    My Upload.aspx :
    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="upload.aspx.cs" Inherits="dialogs_upload" %>
      
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      
    <head runat="server">
        <title></title>
    <script type="text/javascript">
        var Nbre = 0;
            function getRadWindow() {
                var oWindow = null;
                if (window.radWindow) oWindow = window.radWindow;
                else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow;
                return oWindow;
            }
            function CloseWindow() {
                var wnd = getRadWindow();
                var openerPage = wnd.BrowserWindow;
                openerPage.Importer_Callback();
                wnd.close();
            }
            function validateRadUpload1(source, arguments) {
                arguments.IsValid = $find('RadUpload1').validateExtensions();
            }
            function fileUploaded(sender, args) {
                Nbre++;
                var name = args.get_fileName();
                var $ = $telerik.$;
                  $(".info-panel").text(Nbre).show();  
            }
              
            </script>
            <link href="../css/principal.css" rel="stylesheet" type="text/css" />
    </head>
    <body>
        <form runat="server" id="mainForm" method="post">
            <telerik:RadScriptManager ID="ScriptManager" runat="server" /> 
            <telerik:RadFormDecorator ID="FormDecorator1" runat="server" DecoratedControls="all"></telerik:RadFormDecorator>
            <telerik:RadProgressManager runat="server" ID="RadProgressManager1" />
            <div class="popup-texte-edit" style="height:30px; padding:5px"><strong>Cliquez sur le bouton "Parcourir" et selectionnez le ou les fichiers à importer</strong><br /><em>(utilisez la touche 'CTRL' pour séléctionner plusieurs fichiers à la fois).</em></div>
            <div style="margin:10px;background-color: #EEEEEE;">
                <div style="background-color: #CC0000; color: #FFDDDD; font-size: 11px; margin-bottom: 10px; padding: 5px;">Fichiers autorisés : <strong><asp:Literal ID="FileAllowed" runat="server" Text="" /></strong><span style="color:#fff; font-size:11px;float:right;display:inline-block">(Taille maximale du fichier : 300 Mo)</span></div>
                <div style="background-color: #EEEEEE; border: 1px dashed #CCCCCC; height: 180px; overflow-y: auto; padding: 5px 10px;" class="upload-panel">
                    <telerik:RadAsyncUpload runat="server" ID="AsyncUpload1" MaxFileSize="300000000" OnClientFileUploaded="fileUploaded" ControlObjectsVisibility="None" ReadOnlyFileInputs="true" InitialFileInputsCount="1" MaxFileInputsCount="1" InputSize="70" Localization-Remove="Supprimer" Localization-Select="Parcourir" />
                    <asp:CustomValidator ID="Customvalidator1" runat="server" Display="Dynamic" ClientValidationFunction="validateRadUpload1">
                    <span style="FONT-SIZE: 11px;margin-left:50px;font-weight:bold;color:#ff0000">!!! Type de fichier incorrect !!!</span>
                    </asp:CustomValidator><asp:Literal ID="MaxFileError" runat="server" />
                </div>
                <div style="background-color: #ddd; float: left; width: 100%;">
                    <div style="background-color: #ddd; float: left; width: 312px;line-height: 22px;"> <asp:CheckBox ID="Encodage" runat="server" Text="Encoder la vidéo" /></div>
                    <div style="background-color: #ddd; float: right; font-size: 11px; line-height: 22px; padding: 0 10px; text-align: right; width: 215px;">Nbre de fichiers importés : <span class="info-panel" style="font-weight:bold;display:inline">0</span></div>
                </div>
            </div>
            <div style="position: absolute; top: 100px; left: 73px;"><telerik:RadProgressArea runat="server" ID="RadProgressArea1"></telerik:RadProgressArea></div>
            <div id="ErrorHolder"></div>
            <table width="100%" cellspacing="5">
                <tr>
                    <td align="center" height="50" valign="middle"><asp:Button id="buttonSubmit" runat="server" CssClass="RadUploadSubmit" OnClick="buttonSubmit_Click" Text="Valider" /></td>
                    <td align="center" height="50" valign="middle"><asp:Button ID="Button2" runat="server" Text="Annuler" CausesValidation="false"  OnClientClick="return CloseWindow();" /></td>
                </tr>
            </table>
        </form>
    </body>
    </html>

    My upload.aspx.cs :
    using System;
    using System.Collections;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.IO;
    using System.Web;
    using System.Web.SessionState;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.HtmlControls;
    using Telerik.Web.UI;
    using Telerik;
      
    public partial class dialogs_upload : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.Params["Mode"] != null)
            {
                RadProgressArea1.Localization.Uploaded = "Progression totale : ";
                RadProgressArea1.Localization.UploadedFiles = "Progression : ";
                RadProgressArea1.Localization.CurrentFileName = "Progession en cours : ";
                RadProgressArea1.Localization.ElapsedTime = "Temps : ";
                RadProgressArea1.Localization.EstimatedTime = "Temps estimé : ";
                RadProgressArea1.Localization.TotalFiles = "Total : ";
                RadProgressArea1.Localization.TransferSpeed = "Vitesse : ";
      
                if (Request.Params["Mode"].ToString() == "photos")
                {
                    FileAllowed.Text = "*.jpeg, *.jpg";
                    AsyncUpload1.AllowedFileExtensions = new string[] { ".jpg", ".jpeg", ".gif" };
                    Encodage.Visible = false;
                    AsyncUpload1.ControlObjectsVisibility = Telerik.Web.UI.ControlObjectsVisibility.None;
                    AsyncUpload1.MultipleFileSelection = Telerik.Web.UI.AsyncUpload.MultipleFileSelection.Automatic;
                }
                if (Request.Params["Mode"].ToString() == "videos")
                {
                    FileAllowed.Text = "*.flv, *.avi, *.mov, *.mp4, *.mpeg, *.mpg, *.wmv";
                    AsyncUpload1.AllowedFileExtensions = new string[] { ".flv", ".avi", ".mov", ".mp4", ".mpeg", ".mpg", ".wmv" };
                    AsyncUpload1.MaxFileInputsCount = 1;
                    AsyncUpload1.ControlObjectsVisibility = Telerik.Web.UI.ControlObjectsVisibility.None;
                    AsyncUpload1.MultipleFileSelection = Telerik.Web.UI.AsyncUpload.MultipleFileSelection.Disabled;
                    AsyncUpload1.TemporaryFolder = Server.MapPath("/WorkingFolder/");
                }
                if (Request.Params["Mode"].ToString() == "audio")
                {
                    FileAllowed.Text = "*.mp3,*.wav,*.flv, *.avi, *.mov, *.mp4, *.mpeg, *.mpg, *.wmv, *.mp2";
                    AsyncUpload1.AllowedFileExtensions = new string[] { ".mp3", "wav", ".flv", ".avi", ".mov", ".mp4", ".mpeg", ".mpg", ".wmv", ".mp2", ".wma" };
                    Encodage.Visible = false;
                    AsyncUpload1.MaxFileInputsCount = 1;
                    AsyncUpload1.ControlObjectsVisibility = Telerik.Web.UI.ControlObjectsVisibility.None;
                    AsyncUpload1.MultipleFileSelection = Telerik.Web.UI.AsyncUpload.MultipleFileSelection.Disabled;
                }
            }
      
        }
      
        protected void buttonSubmit_Click(object sender, System.EventArgs e)
        {
            string targetFolder = "", filename = "", fileWithoutExtension = "";
            bool encoder = false;
            if (AsyncUpload1.UploadedFiles.Count > 0)
            {
                foreach (UploadedFile validFile in AsyncUpload1.UploadedFiles)
                {
                    filename = validFile.GetName();
                    fileWithoutExtension = validFile.GetNameWithoutExtension();
                    encoder = Encodage.Checked;
                    if (Request.Params["Mode"].ToString() == "videos")
                    {
                        if (((validFile.GetExtension() != ".flv") && (validFile.GetExtension() != ".mp4")) || (encoder)) { targetFolder = Server.MapPath("/WorkingFolder/"); encoder = true; }
                        else { targetFolder = Server.MapPath(Request.Params["Folder"].ToString()); }
                    }
                    else if (Request.Params["Mode"].ToString() == "audio")
                    {
                          
                        if ((validFile.GetExtension() != ".mp3")) { targetFolder = Server.MapPath("/WorkingFolder/"); encoder = true; }
                        else { targetFolder = Server.MapPath(Request.Params["Folder"].ToString()); }
                    }
                    else { targetFolder = Server.MapPath(Request.Params["Folder"].ToString()); }
      
                    filename =  validFile.GetExtension();
                    fileWithoutExtension = fileWithoutExtension;
                    validFile.SaveAs(Path.Combine(targetFolder, filename), true);          
                }
           }       
        }
      
        protected void Customvalidator1_ServerValidate(object source, ServerValidateEventArgs args)
        {
            args.IsValid = (AsyncUpload1.InvalidFiles.Count == 0);
        }
      
        protected void RadUpload1_ValidatingFile(object sender, Telerik.Web.UI.Upload.ValidateFileEventArgs e)
        {
                long maxZipFileSize = 300000000;
                if (e.UploadedFile.ContentLength > maxZipFileSize)
                {
                    e.IsValid = false;
                }
                e.SkipInternalValidation = true;
        }
    }

    I don't found any documentation about this problem !

    Can someone help me ?

    thanx
  2. CHOVA
    CHOVA avatar
    4 posts
    Member since:
    Jul 2010

    Posted 09 Feb 2011 Link to this post

    No solution ?
  3. Answer
    Kate
    Admin
    Kate avatar
    1898 posts

    Posted 10 Feb 2011 Link to this post

    Hello CHOVA,

    You would also need to se requestLength in the web.config file:
    <httpRuntime maxRequestLength="314572800" executionTimeout="3600" />

    Here is more information about that.

    Kind regards,
    Kate
    the Telerik team
    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Back to Top