J
Josee
function validateImageDimension(path, expectedWidth, expectedHeight) {
var img = new Image();
img.src = path;
return (img.width == expectedWidth && img.height ==
expectedHeight);
}
function uploadCustomerLogo() {
var customerLogoFilePath =
document.getElementById("customerLogoFile").value;
if (!validateImageDimension(customerLogoFilePath, 160,
160)) {
alert('wrong size');
return;
}
I have this javascript to validate image dimension before uploading.
It was working fine in IE6. But it doesn't work anymore in IE7.
Because the image width and height is return as 0.
Anyone has idea how to fix this? Or a better way to do this?
Thanks
var img = new Image();
img.src = path;
return (img.width == expectedWidth && img.height ==
expectedHeight);
}
function uploadCustomerLogo() {
var customerLogoFilePath =
document.getElementById("customerLogoFile").value;
if (!validateImageDimension(customerLogoFilePath, 160,
160)) {
alert('wrong size');
return;
}
I have this javascript to validate image dimension before uploading.
It was working fine in IE6. But it doesn't work anymore in IE7.
Because the image width and height is return as 0.
Anyone has idea how to fix this? Or a better way to do this?
Thanks