Reputation: 95
I want to validate the file size before upload on IE8+
I tried
Validate File size before upload
But didn't work.
And I can't configure every IE browser to use the "ActiveXObject" (I saw that is one way for the solution).
What I should do?
Upvotes: 3
Views: 865
Reputation: 34846
Using the ASP.NET FileUpload
control you cannot use code to validate the size of a file and inform the user.
If you want a better user experience, then I suggest you investigate some open source solutions like the following:
Custom HTTP module
NeatUpload is a free option.
Silverlight/Flash option
SWFUpload is a free option.
Asynchronous chunking option
RadAsyncUpload - Telerik's ASP.NET AsyncUpload is a pay option, check website for pricing.
Upvotes: 1
Reputation: 1837
Try this
<form enctype="multipart/form-data">
<label for="file">Filename:</label>
<input type="file" name="file" id="myFile"><br>
</form>
<script>
$('#myFile').bind('change', function() {
alert(this.files[0].size);
});
</script>
Upvotes: 0