You simply cannot know the file size in JS on the client.
, , , :
BeginRequest:
HttpWorkerRequest workerRequest = (HttpWorkerRequest)context.GetType().GetProperty("WorkerRequest", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(context, null);
if (workerRequest.HasEntityBody())
{
long contentLength = long.Parse((workerRequest.GetKnownRequestHeader(HttpWorkerRequest.HeaderContentLength)));
if (contentLength > MAX_UPLOAD_FILE_SIZE * 1024 )
{
workerRequest.CloseConnection();
context.Response.Redirect(SomeErrorPage);
}
}
,
EDIT: , . , FILE SIZE,