Drake
Drake

Reputation: 3891

jquery input file missing text

When I get the text from a input element that has the type of file

$("#selected-file").val() or .text()
//only returns the name of the file selected. not the entire path

how can I get all of the text from the element?

Upvotes: 0

Views: 132

Answers (2)

Jagan Chennai
Jagan Chennai

Reputation: 91

It is based upon the browser. you have to use some user defined function to get filename.

try by spliting the url by / and get the last array element.

Upvotes: 0

Gabriele Petrioli
Gabriele Petrioli

Reputation: 196132

You cannot get the full local path of a file. (for security reasons)

Also it is not much use, since you do not have access to the local maching..

Upvotes: 2

Related Questions