How to set maximum file size for upload

From Sense/Net Wiki
Revision as of 15:40, 30 April 2014 by MiklosToth (Talk | contribs) (Overview)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
  • 100%
  • 6.0
  • Enterprise
  • Community
  • Planned


Sense/Net by default allows files of size 8MB to be uploaded via the built-in upload control, and 100MB (from versions above 6.1.1) to be uploaded via webdav. This how-to describes how to change these default settings.

In case you are working with large files, regularly updating those can be slower than uploading new ones. In this case please consider using the FILESTREAM feature.


1. Set property of upload control

The upload control defines a property that sets the uploadable file size limit. The control markup containing the upload control in the default install can be found here:


The markup contains an sn:listviewupload element, that has a file_size_limit property. The following markup shows how to configure the upload control to enable files of 100MB to be uploaded via the upload control:

    <sn:listviewupload id="FileUploader" runat="server" cssclass="sn-dialog-upload" flashurl="/Root/Global/scripts/swfupload/swfupload.swf"
        uploadurl="/UploadProxy.ashx" begin_upload_on_queue="true" file_queue_limit="0"
        file_size_limit="102400" file_types="*.*" file_types_description="All files" file_upload_limit="0"
        allowothercontenttype="true" designmode="dialog" button_placeholder_id="spanButtonPlaceholder"
        minimum_flash_version="9.0.28" button_window_mode="transparent" button_cursor="-2"
        button_width="150" button_height="22" />

2. Change web.config settings

The upload control uses chunked uploading and thus the above settings are adequate for uploading files via the built-in upload control. However when uploading files via webdav the request length could exceed a limit and thus the IIS will deny these requests. This limit can be configured in the web.config with the following settings:

    <!-- Enable large file upload via webdav/upload. Max file size in KB. -->
    <httpRuntime maxRequestLength="102400" requestLengthDiskThreshold="102400" requestValidationMode="2.0" />


        <!-- Enable large file upload via webdav/upload. Max file size in bytes. -->
        <requestLimits maxAllowedContentLength="104857600" />

Related links


There are no external references for this article.