Get file name on drag and drop FileReader
<p>Hi I am using native HTML5 drag and drop to upload files to the server. I want to get the name of the file being uploaded from the local system. I am unable to get the name of the file being dropped in the drop zone. Below is the code i have tried. Any help would be appreciated</p>

<pre><code>var reader = new FileReader();
    reader.onload = function (event) {
        var childrenDivs = document.getElementById("holder").children
        var temp    
        if(childrenDivs.length &gt; 0){

            var lastDiv = childrenDivs[childrenDivs.length - 1]
            temp = parseInt(lastDiv.id.split("_")[1]) + 1
        }else{

            temp = 1
        }
      var imageDiv = document.createElement('div')
      imageDiv.id = "uploadedImage_"+temp
      var image = new Image();
      image.src = event.target.result;
      console.log(event.target.fileName)
</code></pre>

<p>instead of <code>console.log(event.target.fileName)</code> i have also tried <code>console.log(event.target.files[0].name)</code> and <code>console.log(event.dataTrasfer.files[0])</code>. Could anyone please help me out here.</p>