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?

3
  • By path you mean the path of the file on the user's computer? Commented Mar 11, 2013 at 15:41
  • Yes. from the input type 'file' Commented Mar 11, 2013 at 15:42
  • So, is there any way I can make playlist through javascript. I want to select file whether it is through my root folder. I want to get file paths ? Commented Mar 11, 2013 at 15:45

2 Answers 2

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.

Sign up to request clarification or add additional context in comments.

1 Comment

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 <form enctype="multipart/form-data" action="/VideoFiles/" method="post"> <input id="inputAddVideo" onchange="AddVideo(this.id)" type="file" name="upload" multiple="multiple"/> <input type="submit"/> </form>
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.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.