I am new to Jquery and ASP.NET so maybe my question will seem naive to some of you.
I need to check file size before upload it to the server.
I have this ASP.NET code:
<div class="label">
Select file
</div>
<asp:FileUpload ID="fileAsyncUpload" runat="server" Width="270" />
<asp:Button ID="Button1" runat="server" Text="Upload" OnClientClick="GetFileSize()" />
</div>
I have this jquery functions:
function GetFileSize() {
try {
var fileSize = 0;
fileSize = $("#" + '<%= fileAsyncUpload.ClientID %>')[0].files[0].size;
fileSize = fileSize / 1048576;
confirm("Upload file size is :" + fileSize + "Mb")
} catch (e) {
alert("Error is:" + e);
}
}
I googled and found the function GetFileSize() above.
But I cant understand this row:
$("#" + '<%= fileAsyncUpload.ClientID %>')[0].files[0].size;
How does it knows file size? Does it load to browser and then check the size of the file? Or it check the size on client computer?