Solution to Nonfile portion & gt; 4194304 bytes error caused by using the NeatUpload large file upload Control

Source: Internet
Author: User

Today, I encountered a problem: "The NeatUpload large file upload control caused Nonfile portion> 4194304 bytes error". Baidu found a solution to this problem and shared it with you:

NeatUpload is an open-source large file upload control. It is very powerful and supports file type filtering, upload progress bar display, multi-File Upload, and other powerful functions.

However, after the project is deployed, an error occurs in some places during normal FileUpload upload (Nonfile portion> 4194304 bytes, the file is larger than the default value of 4 MB ), if the NeatUpload control is used and the upload progress bar needs to be displayed. add the following code to config:

<HttpModules>
<Add name = "UploadHttpModule" type = "Brettle. Web. NeatUpload. UploadHttpModule, Brettle. Web. NeatUpload"/>

</HttpModules>

This httpModule is used by default on the entire site. When you use FileUpload to upload files, you cannot upload files larger than 4 MB (default, even if

The solution is as follows:

1. Add the following code to <configuration>:

<ConfigSections>
<SectionGroup name = "system. web">
<Section name = "neatUpload" type = "Brettle. Web. NeatUpload. ConfigSectionHandler, Brettle. Web. NeatUpload" allowLocation = "true"/>
</SectionGroup>
</ConfigSections>

 

2. Insert the following code in the <system. web> section (this method is global and 3rd is for a page ):

<NeatUpload useHttpModule = "true" maxNormalRequestLength = "40960" maxRequestLength = "2097151" defaultProvider = "FilesystemUploadStorageProvider">
<Providers>
<Add name = "FilesystemUploadStorageProvider" type = "Brettle. Web. NeatUpload. FilesystemUploadStorageProvider, Brettle. Web. NeatUpload"/>
</Providers>
</NeatUpload>

This method modifies the value of maxNormalRequestLength to 40960 (40 M). Changing useHttpModule to false does not matter.

 

3. Add the following code at the end of <configuration> (this method is for a page ):

<Location path = "UploadFile. aspx"> <! -- Upload File page path -->
<System. web>
<NeatUpload useHttpModule = "true"/> <! -- True indicates that the httpModule of neatUpload is used, and false indicates not to use -->
<HttpRuntime maxRequestLength = "40960" executionTimeout = "3600" useFullyQualifiedRedirectUrl = "true"/> <! -- Maximum allowed value: 40 MB -->
</System. web>
</Location>

 

The attributes of the neatUpload node are described as follows: 

<NeatUpload
UseHttpModule = "true or false, defaults to true"
MaxNormalRequestLength = "up to 2097151 in KBytes, defaults to 4096"
MaxRequestLength = "up to 2097151 in KBytes, ults to 2097151"
MaxUploadRate = "rate in KBytes/sec, defaults to-1 which means unlimited"
PostBackIDQueryParam = "parameter name, defaults to NeatUpload_PostBackID"
MultiRequestUploadHandlerUrl = "URL that handles the requests in a multi-request upload, defaults ~ /NeatUpload/MultiRequestUploadHandler. ashx"
DebugDirectory = "directory to which debug info shocould be written, defaults to none"
Decryption = "name of the specified ricalgorithm to use to encrypt/decrypt protected data, defaults to. NET default algorithm used by using ricalgorithm. Create ()"
Validation = "name of the HashAlgorithm to use to validate protected data, defaults to. NET default algorithm used by HashAlgorithm. Create ()"
DecryptionKey = "32 hex-digit key used to encrypt/decrypt protected data, defaults to auto-generated for each app instance"
StateMergeIntervalSeconds = "secs between merges of the current and stored upload states, ults to 1"
StateStaleAfterSeconds = "secs before an unchanged upload state can be removed from the store, ults to 60"
DefaultStorageProvider = "friendly name, defaults to a FilesystemUploadStorageProvider with default temp dir"
DefaultStateStoreProvider = "friendly name, defaults to a AdaptiveUploadStateStoreProvider"
>
<Providers>
<Add name = "friendly name" type = "type derived from Brettle. Web. NeatUpload. UploadStorageProvider"/>
</Providers>
</NeatUpload>

Originally from: http://blog.csdn.net/fgdfgasd/article/details/7108973

Share it with friends who encounter the same problem.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.