参考文档:
http://stackoverflow.com/questions/8903854/check-image-width-and-height-on-upload-with-javascript

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title></title>
    <script src="jquery.min.js"></script>
</head>
<body>
<form>
    <div class="abc">aa</div>
    <input id="image-file" type="file" name="file"/>
    <input id="textInput" name="filetext"/>
    <script type="text/javascript">
        var _URL = window.URL || window.webkitURL;
        $('#image-file').bind('change', function () {
            if ((file = this.files[0])) {
                img = new Image();
                img.onload = function () {
                    alert(this.width + " " + this.height);
                };
                img.src = _URL.createObjectURL(file);
            }
        });
    </script>
</form>
</body>
</html>

更多推荐