How to get the full path to the selected folder
I created <input type="file" name="files" id="fld1" webkitdirectory > in the html file.
I can get 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 to the directory selected in javascript. please, help
I want to show all image files available in any folder using the jquery slider. I can get the name of the files present in this folder, but I can not get the full path to the folder. how can i get this.
I did 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> Check the File API documentation , the File section contains information about the File object.
Quote from the document:
File name; upon receipt, this should return the file name as a string. There are many file name options for different systems; it's just a file name, no path information . Upon receipt, if user agents cannot make this information available, they should return an empty string.