kartikkowligi
kartikkowligi

Reputation:

How to extract the entire path when a user uploads a file using jquery

I am trying to extract the entire path of the file that a user uploads on the browser and this i need to do using javascript or jquery.

If i give ($("#userfile").val()); i am able to extract only the file name and not the entire path.

Could someone please help me with this?

Upvotes: 3

Views: 2014

Answers (4)

Martin Dobrev
Martin Dobrev

Reputation: 11

With IE8 this is not the case too. IE8 hides the real path to the file and changes it, for example, to:

C:\\**fakepath**\filename

Upvotes: 1

user731144
user731144

Reputation: 25

as indicated above this is usually permission issue. try and and move the file to a different area and grant it full permissions.

var path = $('#file').attr("value");

this will also give you the path of the file

Upvotes: 1

Scott Evernden
Scott Evernden

Reputation: 39986

Internet explorer will give you the full path, but other browsers won't. here's an example page i found that demonstrates this

Upvotes: 2

nickf
nickf

Reputation: 546503

I believe that it's a security measure to not reveal the entire path of file inputs.

Upvotes: 2

Related Questions