How do validate my the size of a file on the client.

I am using a FileUpload server control to upload a file to the server. I want to know how I would use java script to validate the size of the file on the client.
[161 byte] By [AlfredChinedu] at [2007-12-25]
# 1

hi! i have the same problem, i using ASP.net, i think this code helpful for you

function A()
{
var oas = new ActiveXObject("Scripting.FileSystemObject");
var d = document.getElementById('<%= fileUpLoad.ClientID %>').value;
var e = oas.GetFile(d);
var f = e.size;
alert(f + " bytes");

}

<asp:FileUpload ID="fileUpload" runat="server"/>

<asp:button Id="btn" runat="server" OnClientClick="A();" />

i tested it, but it work properly without masterpage

phamsyquy at 2007-9-3 > top of Msdn Tech,.NET Development,JScript for the .NET Framework...

.NET Development

Site Classified