Home  >  Article  >  Web Front-end  >  How to use JS to get the IE upload file path (IE7,8)_javascript skills

How to use JS to get the IE upload file path (IE7,8)_javascript skills

WBOY
WBOYOriginal
2016-05-16 17:29:371542browse
Copy code The code is as follows:

function validateFileSize(id, maxsize) {
var btnsave = document .getElementById("Button2");                btnsave.disabled = false; fileupload.value.length< ; 5) { alert('Please select a file!'); return; }
           var agent = window.navigator.userAgent;
                                                            Msie 7.0 ')! = -1;
var isIe8 = agent.indexof (' msie 8.0 ')! = -1;
// IE7 and IE8 get file path
if (ISIE7 || ISIE8) { Fileupload.select ();
Filepath = Document.selection.createrange (). Text;
}> // IE6 Get the file path
Else
{filepath = file. value; }
//PageMethods.ValidateFile(filepath, maxsize, ieCallBack);
alert(filepath);
}
if (agent.indexOf( "Firefox") >= 1) {
           alert("FF");                      alert(getValue());              var size = fileupload.files[0].fileSize ;
                                                                                                              " onchange="disableSave(this);"/> ';
         alert("File exceeds size! " ); }

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn