I am uploading a file in an ASP.NET application, I need to get the file size for some client side validation. Following the advice I found here. I have something like this:
in aspx:
<td class="form_input_bold">
<asp:FileUpload Width="80%" ID="fuUploadFile" CssClass="button" runat="server" Font-Names="Verdana" />
</td>
And in Javascript:
var inputFile = document.getElementById('ctl00_ContentPlaceHolder1_fuUploadFile');
alert("File size: " + inputFile.size);
Now for some reason, when I try to upload a 50 MB file, inputFile.size returns 20. Can anyone tell why this is? ASP.NET is getting the correct size server side..
document.getElementById("<%= fuUploadFile.ClientID %>"), which will render the way you have it.