Forum Moderators: open

Message Too Old, No Replies

Firefox Question

         

andrewsmd

4:18 pm on Jul 17, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I have this JS (well its actually borrowed from gcarn) but it places the path name into a text box once you enter it in the browse button. However, it only places the file name if firefox i.e. if the path is c:\some folder\some file.txt firefox only shows some file.txt while IE shows the full path. Any ideas on how to fix this. Thanks,
<script>
function runMe(imafilevalue){
var textBox=document.getElementById('text');
textBox.value=imafilevalue;
}
</script>

<form ENCTYPE="multipart/form-data" name = "fileSplit" method = "post">
<input type = "text" name = "text" id='text' size = "32">
<INPUT NAME="userfile" TYPE="file" onblur="runMe(this.value)">
</form>

rocknbil

8:35 pm on Jul 17, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You can't. As demonstrated, the two browsers manage what is extracted from the file element differently. Guess which one presents fewer security issues? :-)

You also cannot populate the file object value externally (in either browser.) These are all related to browser security - imagine what someone could do on a nefarious web site with the file element if they could use it to read a user's local files.