i have this script to validate the filesize when you upload a file:
$.validator.addMethod('filesize', function(value, element, param) {
// param = size (en bytes)
// element = element to validate (<input>)
// value = value of the element (file name)
return this.optional(element) || (element.files[0].size <= param)
});
and i keep getting this error only in IE9:
SCRIPT5007: Unable to get value of the property '0': object is null or undefined
IE9 Debug says the error is in this line:
return this.optional(element) || (element.files[0].size <= param)
Yeah, IE9 doesn’t have support for file API. You’ll need to do it server-side or use a plugin.