Edit: After a better explanation, I do not think you can simply drag a folder, or select an entire folder using JavaScript's FileAPI. However, if you can alert the user to press CTRL + A inside the directory to select all files you're golden. The example I put together can be achieved by mixing two examples from the FileAPI tutorial from HTML5Rocks:
<div id="drop_zone">Drop files here</div>
<output id="list"></output>
<script>
function handleFileSelect(evt) {
evt.stopPropagation();
evt.preventDefault();
files = evt.dataTransfer.files; // FileList object.
// Loop through the FileList and render image files as thumbnails.
for (var i = 0, f; f = files[i]; i++) {
// Only process image files.
if (!f.type.match('image.*')) {
continue;
}
var reader = new FileReader();
// Closure to capture the file information.
reader.onload = (function(theFile) {
return function(e) {
// Render thumbnail.
var span = document.createElement('span');
span.innerHTML = ['<img class="thumb" src="', e.target.result, '" title="', escape(theFile.name), '"/>'].join('');
document.getElementById('list').insertBefore(span, null);
};
})(f);
// Read in the image file as a data URL.
reader.readAsDataURL(f);
}
function handleDragOver(evt) {
evt.stopPropagation();
evt.preventDefault();
evt.dataTransfer.dropEffect = 'copy'; // Explicitly show this is a copy.
}
// Setup the dnd listeners.
var dropZone = document.getElementById('drop_zone');
dropZone.addEventListener('dragover', handleDragOver, false);
dropZone.addEventListener('drop', handleFileSelect, false);
</script>
You will need to ensure that the user is using a more modern browser, I tried in Chrome and it works, I can assume Firefox will and I'm not sure what version of IE starts support for the FileAPI.
I'm keeping my original response here for reference, thinking that the request was to get the user's local path as well.
I don't believe there would be a way to do this with JavaScript. Even using the new HTML5 FileAPI it looks like the interface is not implemented to capture the user's local file location, probably for security reasons:
7. The File Interface
//This interface describes a single file in a FileList and exposes its name. It inherits from Blob.
[Constructor(Blob fileBits, [EnsureUTF16] DOMString fileName)]
interface File : Blob {
readonly attribute DOMString name;
readonly attribute Date lastModifiedDate;
};