Article From:
<script type="text/javascript">  

 function loadImage(img) {
            var filePath = img.value;
            var fileExt = filePath.substring(filePath.lastIndexOf("."))
    if (!checkFileExt(fileExt)) {
                alert("The file you uploaded is not a picture, please reupload it! ");Img.value = "";Return;}If (img.files & & img.files[0]) {Var size = (img.files[0].size / 1024).ToFixeD (0);If (size> 2048) {Alert ("picture can't be greater than 2M\n\n, please upload again, thank you!"); window.close ()}}}Function checkFileExt (EXT) {If (! Ext.match (/.jpg|.gif|.bmp/i)) {Return false;}Return true;}< /script>
<input name="Text_Files" type="file" onchange="loadImage(this)" style="width:100%;  height:30px">

Answer 0:

Try onpropertychange () function, but only support IE, IE8, I remember it should be no problem, IE6 and below are not sure.

Answer 1:

jsIt’s not the way to trigger the onchange event

Leave a Reply

Your email address will not be published. Required fields are marked *