Click here to Skip to main content
15,905,414 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
How to write logic in .Cs( Upload limit is 10MB) after 10.1Mb is not accept

Any one please help me.
Posted

XML
This setting goes in your web.config file. It affects the entire application.

<configuration>
  <system.web>
    <httpRuntime maxRequestLength="xxx" />
  </system.web>
</configuration>
"xxx" is in KB. The default is 4096 (= 4 MB).


Let me know if more details required
 
Share this answer
 
Comments
Sai Prasad anumolu 5-Apr-14 0:22am    
Kk thanks sir
Er. Puneet Goel 5-Apr-14 0:27am    
for 10MB replace 'xxx' with '10240'. All the best
If you are using the file upload control, you can directly check the file size.
C#
// Get the size in bytes of the file to upload.
int fileSize = FileUpload1.PostedFile.ContentLength;

// Allow only files less than 4194304 bytes (4 MB) to be uploaded.
if (fileSize < 4194304)
{
   //Do something
}
 
Share this answer
 
Comments
Sai Prasad anumolu 5-Apr-14 0:24am    
I need 10MB sir ...
Abhinav S 5-Apr-14 0:46am    
10 MB? Try 10485760.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900