Possible Duplicate:
Can’t get the complete address while uploading a file
I need the full path.
I'm trying to give the functionality of local bookmarks, ie user wants to access c:\MyStuff\Myfile.xls
on their local Pc.
How do I save/get that value without having to make a tutorial help page on how to cut and paste c:\MyStuff\Myfile.xls
.
The below code works in IE7. I understand the point about it being a security issue, but I don't need to save their choice or even use enctype/multiform, or even submit anything, i just need to get the path they selected.
<html>
<head>
<title></title>
</head>
<body>
<script language="JavaScript" type="text/javascript">
<!--
vic=0;
document.write('<style> .debug {VISIBILITY: visible; POSITION: absolute; TOP: 500px; z-Index:100; }</style>')
<!---->
</script>
Select a file from directory then save the path<br>
<input type="file" id="dir" value="dir" style="width:0px;" >
<input type="button" value="Save Path" onclick="javascript:SavePath();" >
<script language="JavaScript" type="text/javascript">
<!-- works on ie8 not ff.
function SavePath(){
if (document.getElementById('dir').value==''){
alert('Select a file from the directory');
return;
}
Path=document.getElementById('dir').value.substring(0,document.getElementById('dir').value.lastIndexOf('\\'));
alert('variable Path='+Path+'\\ ');
}
//-->
</script>
</body>
</html>