Is there a better way to do this ?
If FileUpload1.PostedFile.ContentLength > 500000 Then
Label1.ForeColor = System.Drawing.Color.Red
Label1.Text = "Please enter a filesize less than 500kb!"
End If
Is there a better way to do this ?
If FileUpload1.PostedFile.ContentLength > 500000 Then
Label1.ForeColor = System.Drawing.Color.Red
Label1.Text = "Please enter a filesize less than 500kb!"
End If
I think IIS 7 uses maxAllowedContentLength for specifying file upload size (KB). Edit your web.config like so:
<system.web>
<httpRuntime maxRequestLength="2097152" />
</system.web>
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="2147483648" />
</requestFiltering>
</security>
</system.webServer>