How To get the full path of the folder selected

dom, html, javascript

Solution

For obvious security reasons you cannot do that. Browsers won't allow you to access and explore the file system of the client computers using javascript. Some browsers will simply return some fake path to the file.

Problem

I have created `<input type="file" name="files" id="fld1" webkitdirectory >` in an html file. i can get the files using ``` var imageFiles = document.getElementById("fld1"), filesLength = imageFiles.files.length; for (var i = 0; i < filesLength; i++) { alert(imageFiles.files[i].name); } ``` How can i get the full path of the directory selected in javascript . please help I want to show all the image files present in any folder using jquery slider. i can get the name of the files present in that folder but i cannot get the full path of the folder. how can i get it. i have done this to get the file path but it only worked in IE ``` <script language="JavaScript"> function GetDirectory() { strFile = document.MyForm.MyFile.value; intPos = strFile.lastIndexOf("\\"); strDirectory = strFile.substring(0, intPos); alert(strFile + '\n\n' + strDirectory); return false; } </script> ```

Original source

Related problems