How to get full path of a file with FileUpload Control?
i am using FileUplo开发者_如何转开发ad 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>
Modern browsers do not give this information since it is considered insecure. There is no consistent way to this with HTML and JavaScript.
精彩评论