Need an image size control before upload

Discussion in 'JavaScript' started by songbacdau, Sep 14, 2006.

  1. #1
    Currently, i want to upload an image, before upload i want to check image dimension with the path in the file upload control value use javascript. My code below:

    function getImgSize(imgSrc)
    {
    var newImg = new Image();
    imgSrc="file://"+imgSrc;
    newImg.src =imgSrc;
    var height = newImg.height;
    var width = newImg.width;
    alert ('The image size is '+width+'*'+height);
    }

    The code get image size:
    getImgSize(document.forname.file_upload_name.value);

    in IE it's ok, but in firefox it's not ok.
    Please help me.
     
    songbacdau, Sep 14, 2006 IP