I’m using a javscript that grabs the file name of the file the user chooses in a upload form. However, I want to grab the URL on their PC where the file is located – how do I do so?
My code:
for (var i = 0; i < input.files.length; i++) {
var li = document.createElement("li");
li.innerHTML = input.files[i].name;
ul.appendChild(li);
}
It shows input.files[i].name but I don’t want the name – I want the URL of where its located. How do I do so?
You can’t do this in Javascript because of the possible security implications; it is in the interest of users that you aren’t able to do this, and so the standard doesn’t specify a method for you to access the URI of the files.
If you really need this functionality, you’ll need to use other third party plugins like Java to do this, though I don’t recommend it.