0

I have an html element input type file. I am getting the multiple file names using this code:

<input id="inputAddVideo" onchange="AddVideo(this.id)" type="file" name="upload" multiple/>

 var files = $('input[type="file"]')[0].files;
    for (var i = 0; i < files.length; i++) {
        alert('path: ' + files[i].path);
        var filename = files[i].name.split('.');
}

Now at the same time, how can I retrieve path of each file using javascript?

user1844205
  • 141
  • 3
  • 7
  • 19

2 Answers2

2

You won't be able to access this via JavaScript; as a security precaution the browser will expose the file name to you, but nothing else about the local file system.

Graham
  • 6,484
  • 2
  • 35
  • 39
  • I have done some searching to upload a file to a specific folder. But when I click submit button, it does not upload the file
    – user1844205 Mar 11 '13 at 15:58
1

You can't.

This is a built in security measure by the browser creators, so private information about local file paths cannot be seen.

Oded
  • 489,969
  • 99
  • 883
  • 1,009