Reputation: 315
When uploading a file, I get the error - out of size exception
I've added the code below trying to get rid of it! - written in vb
dim filesize as string = FileUploadVal.PostedFile.ContentLength
If filesize > 1048576 then
des_label = "File is too large!"
End if
But still getting the error, is there a way to set a file limit before uploading?
Upvotes: 1
Views: 3259
Reputation: 148110
The file size would be greater then the allowed limit in web.config. You can set the HttpRuntimeSection.MaxRequestLength to limit the upload file size.
The MaxRequestLength property specifies the limit for the buffering threshold of the input stream. For example, this limit can be used to prevent denial of service attacks that are caused by users who post large files to the server, MSDN
<httpRuntime
executionTimeout = "HH:MM:SS"
maxRequestLength = "number"
requestLengthDiskThreshold = "number"
useFullyQualifiedRedirectUrl = "[True|False]"
minFreeThreads = "number"
minLocalRequestFreeThreads = "number"
appRequestQueueLimit = "number"
enableKernelOutputCache = "[True|False]"
enableVersionHeader = "[True|False]"
apartmentThreading = "[True|False]"
requireRootedSaveAsPath = "[True|False]"
enable = "[True|False]"
sendCacheControlHeader = "[True|False]"
shutdownTimeout = "HH:MM:SS"
delayNotificationTimeout = "HH:MM:SS"
waitChangeNotification = "number"
maxWaitChangeNotification = "number"
enableHeaderChecking = "[True|False]"
/>
Upvotes: 1