I am trying to implement drag n drop in my application, which need the full path of folder being dropped.
I have done something like this
<html>
<head>
<style>
#dropzone {
height:200px;
width: 200px;
border: 10px dashed #0c0;
background-color:cyan;
}
</style>
</head>
<body>
<div id="dropzone" droppable="true" ondrop ="drop(event)" ondragenter="return false" ondragover="return false">
</div>
<script type="text/javascript">
function drop(e) {
e.stopPropagation();
e.preventDefault();
var length = e.dataTransfer.items.length;
for (var i = 0; i < length; i++) {
var entry = e.dataTransfer.items[i].webkitGetAsEntry();
if (entry.isDirectory) {
alert(entry);//here i need to get path of folder being dropped.
}
}
}
</script>
</body>
</html
If I alert e.dataTransfer.files[i].name
inside for loop
then it only show name of folder but not it's path.
Does Javascript allow access to local file system? OR any workaround for this?