tags:

views:

29

answers:

1

Hi, i am using FileUpload Control in my application to upload user information.when i used javascript to get the value of fileupload Control it give only the name of file in mozilla while in IE it's give the whole path with file name. And i want the file name with whole path. mozilla Result - user.doc IE Result - /usr/local/user.doc (which i want)

<input type="file" id="myFile" />
<input type="button" onclick="getFile();" />

<script type="text/javascript">

function getFile() {
    var fileInput = document.getElementById("myFile").value;
    alert(fileInput);
}

</script>
+1  A: 

Modern browsers do not give this information since it is considered insecure. There is no consistent way to this with HTML and JavaScript.

Squeegy
Is there any way to do it?
Yes. It would be a breach of privacy for browsers to allow this because it would reveal information about the directory structure, including directory names, on the user's computer. It's a bit disconcerting that this is possible in IE.
thomasrutter
It's very predictable that this is possible in IE, isn't it?
floatless