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).
// 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 }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)