Implementing the Maximum size limit of the Uploaded file.

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Implementing the Maximum size limit of the Uploaded file.

Guest-561

Hi Brettle,

Thanks for sharing such an useful tool.

I am using ypur upload tool for my website. But i am not able to restrict the user from uploading file of more than 10MB. I went through the help post, tried to add to web.config file but I am not able to limit the file size.

Could you please help me in this.

I am using Visual Studio .NET 2005

Below is the working model of my web.config file

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <configSections>
        <sectionGroup name="system.web">
            <section name="neatUpload" type="Brettle.Web.NeatUpload.ConfigSectionHandler, Brettle.Web.NeatUpload" allowLocation="true" />
        </sectionGroup>   
    </configSections> 
   <system.web>
      <compilation debug="true"/>
      <authentication mode="Windows"/>
        <httpModules>
            <add name="UploadHttpModule" type="Brettle.Web.NeatUpload.UploadHttpModule, Brettle.Web.NeatUpload" />           
        </httpModules>
        <httpRuntime  maxRequestLength="10240" executionTimeout="360"/>              
   </system.web>

   <appSettings>
     
   </appSettings>
</configuration>

Could you please send me the settings and place to add in this config file.

My email id is engg.mukesh@rediffmail.com

Mukesh Agarwal.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Implementing the Maximum size limit of the Uploaded file.

Dean Brettle
Administrator
Per the Limiting the Size of Upload Requests section of the manual, you need to add:

<neatUpload maxRequestLength="10240" />

in your <system.web> section.


--Dean
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Implementing the Maximum size limit of the Uploaded file.

Guest-561

It worked.

Thanks a lot.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Implementing the Maximum size limit of the Uploaded file.

Guest-561
Hi,
Since I have implemented the size limit, so, I am getting the following error in case user tries to upload a bigger file.
"Rejected: Total size > 10485760 bytes"
Is it possible to modify this message.
If yes than please let me know how to do that.
Thanks in advance.
- Mukesh
 
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Implementing the Maximum size limit of the Uploaded file.

Dean Brettle
Administrator
Per the Customizing Progress.aspx section of the manual, you can modify Progress.aspx to change the word "Rejected:" to something else, and you can modify the rest of the string by changing the UploadTooLargeMessageFormat resource in Strings.resx or implementing a custom GetResourceString() method to return a different value for that resource.

--Dean
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Implementing the Maximum size limit of the Uploaded file.

webmaster_2x
In reply to this post by Guest-561

i'm not sure if this is a right place but my problem is something similar

i guess it is normal to get error message Rejected: Total size > xxxx bytes in progress bar but instead i get exception:

Server Error in '/' Application
Total size > xxxx bytes

Exception Details: Brettle.Web.NeatUpload.UploadTooLargeException: Total size > 3072 bytes

--------------

Source Error:

Line 319: {
Line 320: if (log.IsDebugEnabled) log.Debug("Request Entity Too Large");
Line 321: throw new UploadTooLargeException(UploadHttpModule.MaxRequestLength, grandTotalBytesRead);
Line 322: }
Line 323: if (preloadedEntityBodyStream.Length > UploadHttpModule.MaxNormalRequestLength )
 

Source File: D:\Visual Studio\Visual Studio 2008\Projects\Seminar2010\NeatUpload.1.3.26\Brettle.Web.NeatUpload\Brettle.Web.NeatUpload.Internal.Module\FilteringWorkerRequest.cs    Line: 321


---------------

Stack Trace:


[UploadTooLargeException: Total size > 3072 bytes]
   Brettle.Web.NeatUpload.Internal.Module.FilteringWorkerRequest.WriteParsedToOutputStream() in D:\Visual Studio\Visual Studio 2008\Projects\Seminar2010\NeatUpload.1.3.26\Brettle.Web.NeatUpload\Brettle.Web.NeatUpload.Internal.Module\FilteringWorkerRequest.cs:321
   Brettle.Web.NeatUpload.Internal.Module.FilteringWorkerRequest.CopyUntilBoundary() in D:\Visual Studio\Visual Studio 2008\Projects\Seminar2010\NeatUpload.1.3.26\Brettle.Web.NeatUpload\Brettle.Web.NeatUpload.Internal.Module\FilteringWorkerRequest.cs:361
   Brettle.Web.NeatUpload.Internal.Module.FilteringWorkerRequest.ParseOrThrow() in D:\Visual Studio\Visual Studio 2008\Projects\Seminar2010\NeatUpload.1.3.26\Brettle.Web.NeatUpload\Brettle.Web.NeatUpload.Internal.Module\FilteringWorkerRequest.cs:552
   Brettle.Web.NeatUpload.Internal.Module.FilteringWorkerRequest.ParseMultipart() in D:\Visual Studio\Visual Studio 2008\Projects\Seminar2010\NeatUpload.1.3.26\Brettle.Web.NeatUpload\Brettle.Web.NeatUpload.Internal.Module\FilteringWorkerRequest.cs:473
   Brettle.Web.NeatUpload.UploadHttpModule.WaitForUploadToComplete() in D:\Visual Studio\Visual Studio 2008\Projects\Seminar2010\NeatUpload.1.3.26\Brettle.Web.NeatUpload\Brettle.Web.NeatUpload\UploadHttpModule.cs:246
   Brettle.Web.NeatUpload.UploadHttpModule.Application_ResolveRequestCache(Object sender, EventArgs e) in D:\Visual Studio\Visual Studio 2008\Projects\Seminar2010\NeatUpload.1.3.26\Brettle.Web.NeatUpload\Brettle.Web.NeatUpload\UploadHttpModule.cs:559
   System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +68
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75

 
Loading...