我有一个:
<img id="uploadedimage" alt="uploaded image" src="" width="250px" height="250px"/>
一旦用户使用此 JQuery 代码选择了他们的图像,并且有一个 div 来显示图像:
$('#BusinessImage').change(function (ev) {
var f = ev.target.files[0];
var fr = new FileReader();
var IsImage = false;
// check the file is an image
if (f.type.match('image.*')) {
IsImage = true;
}
fr.onload = function (ev2) {
if (IsImage) {
$('#uploadedimage').attr('src', ev2.target.result);
}
};
if (IsImage) {
fr.readAsDataURL(f);
ValidFileUpload();
}
else {
InvalidFileUpload();
}
});
当然,这段代码在除撒旦浏览器 Internet Explorer 之外的所有其他浏览器中都运行良好。我收到此错误:
Line: 108
Character: 13
Code: 0
Error Message: Unable to get value of the property '0': object is null or undefined
有谁知道是什么原因造成的,因为它在 FFX 和 Chrome 中运行良好。
谢谢