我需要验证要上传到服务器的文件。上传之前必须完成验证。即验证在客户端完成。这个任务应该在ASP.NET MVC3网页中完成。它也应该适用于所有浏览器。 IE9,8,7/FF/Chrome浏览器。我开始知道IE没有FileReader API。在上传前验证文件大小
我的问题是,如何在上传到MVC3网页之前验证文件大小。
HTML语法
<input type="file" id="myFile" />
JavaScript语法
//gets the element by its id
var myFile = document.getElementById('myFile');
//binds to onchange event of the input field
myFile.addEventListener('change', function() {
//this.files[0].size gets the size of your file.
alert(this.files[0].size);
});
但是,当它:
@Praveen这是否帮助你吗? – Termato 2014-07-24 15:37:57