JS를 사용하여 IE 업로드 파일 경로를 가져오는 방법(IE7,8)

1964 단어
 
  
function validateFileSize(id, maxsize) {
            var btnsave = document.getElementById("Button2");
            btnsave.disabled = false;
            var filepath = "";
            var fileupload = document.getElementById(id);
            if (fileupload.value.length < 5) { alert(' !'); return; }
            var agent = window.navigator.userAgent;
            if (document.all) {
                var isIE7 = agent.indexOf('MSIE 7.0') != -1;
                var isIE8 = agent.indexOf('MSIE 8.0') != -1;
                //IE7 IE8
                if (isIE7 || isIE8) {
                    fileupload.select();
                    filepath = document.selection.createRange().text;
                }
                //IE6
                else
                { filepath = file.value; }
                //PageMethods.ValidateFile(filepath, maxsize, ieCallBack);
                alert(filepath);
            }
            if (agent.indexOf("Firefox") >= 1) {
                alert("FF");
                alert(getValue());
                return false;
                if (fileupload.files) {
                    var size = fileupload.files[0].fileSize;
                    if (size > parseInt(maxsize)) {
                        fileupload.parentNode.innerHTML = ' ';
                        alert(" !");
                    }
                    else { alert(" !"); }
                }
            }
        }

좋은 웹페이지 즐겨찾기