You can set the maximum file size allowed in your web.config by modifying the httpRunTime element
http://programming.top54u.com/post/ASP-Net-FileUpload-Size-Limit-Example.aspx[
^]
e.g
<httpRuntime maxRequestLength="2048" />
You can also have a look at something like in this thread
http://bytes.com/topic/asp-net/answers/446834-how-check-filesize-using-fileupload-control[
^]
Protected Sub Upload_Click () Handles As Upload.Click
If FileUpload1.PostedFile.ContentLength > 10240 then
lblMessage.Text = "File is too large."
Else
FileUpload1.PostedFile.SaveAs(Location)
End If
End Sub
You can't reliably get the file size from any client scripting languages, file manipulation on the client would be a large security hole.