This article is the use of JS to obtain IE Upload file path implementation code for a detailed analysis of the introduction, the need for friends under the reference
copy code code as follows:
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 (' Please select File! '); 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 and IE8 get file Paths
if (isIE7 | | isIE8) {
Fileupload.select ();
filepath = Document.selection.createRange (). text;
}
//ie6 Get file path
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 = ' <input type= ' file ' name= ' + fileupload.name + ' "id=" ' + fileupload.id + ' "Onchang E= "Disablesave (this);" /> ';
alert ("File exceeds size!") ");
}
Else {alert ("File Upload succeeded!") "); }
}
}
}