I’m using the drop event in JavaScript to upload files using the following code:
var fileName = event.dataTransfer.files[0].name;
var orgValue = document.getElementById('<%=tbfilesCollections.ClientID%>').value;
if (orgValue == 'undefined') {
orgValue = '';
}
orgValue += orgValue == '' ? '' : '\n';
orgValue += "*" + fileName;
document.getElementById('<%=tbfilesCollections.ClientID%>').value = orgValue;
event.preventDefault();
return false;
But this code only gets the file name… I need to get the full path of the file.
As this post points out, you cannot get the full path as you would like: Javascript File Drop.
As mentioned in the comments by Michael Sandino, there is a way to do this in Firefox with the “mozFullPath” attribute, but I have yet to see a universally-implemented way of accomplishing this.
The reason for this I would imagine is that the browser shouldn’t divulge information regarding the folder structure of a client computer to a web application, which is understandable.