hi..

im using file upload control to upload some files on my server. but the problem with the same is it uploads the files of specific size only. for ex, if i upload a file in KB's, it works perfectly...but when i try to upload files of more than 1 or 2 mb's, it directly goes on a internet page with error, which is because of the size if the file..

is there any way by which i can upload an file with max size?

Hoping for a reply soon..

Thanks..

Dani AI

Generated

Common cause: the upload is being blocked by server-side limits rather than the FileUpload control itself. As pointed out, raising ASP.NET's request limit often fixes this; as suggested, post the exact exception if you still see the problem — the error text or HTTP code tells you which limit is firing.

Two places to check and change (don’t forget both):

  • ASP.NET-level: httpRuntime has maxRequestLength (measured in KB; default 4096). See the httpRuntime docs for details: .
  • IIS-level (IIS7+): request filtering uses maxAllowedContentLength (measured in bytes). If IIS blocks the request you may see a 404.13 or a 413. Update the requestLimits entry in system.webServer when needed. Example snippet for web.config (adjust bytes to the size you need):
<system.webServer>
  <security>
    <requestFiltering>
      <requestLimits maxAllowedContentLength="52428800" />
    </requestFiltering>
  </security>
</system.webServer>

Troubleshooting checklist

  • Capture the exact exception or HTTP status code (HTTP 413 / IIS 404.13 or ASP.NET “Maximum request length exceeded”).
  • Restart the app after web.config changes and check IIS logs / Windows Event Viewer.
  • If hosted, verify the host permits changes — some providers enforce limits at the control panel.
  • For very large uploads consider chunked/streamed uploads or uploading directly to object storage (to avoid buffering and heavy server load).
  • Keep security in mind: validate file type/size, use authentication, and don’t set unlimited sizes.

Adjusting both ASP.NET and IIS settings and confirming the exact error message will pinpoint the fix.

Recommended Answers

All 2 Replies

Use Try Catch block and post exact exception that is being thrown.

Make the following change in the node of the system.web section of the web.config file:

<httpRuntime maxRequestLength="11000" executionTimeout="275"/>

If does not resolve then post exact error message.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.