0

How do i get the full path of the file in Firefox with JavaScript?

Thanks in advance!

Bill the Lizard
  • 398,270
  • 210
  • 566
  • 880
  • @close voters: The linked "duplicate" seems to me to be asking about getting the full path *server-side*, in the submitted form. (When he says "...if we submit a file..." that's sounding server-side to me.) This is a client-side question. – T.J. Crowder Jun 10 '10 at 22:44
  • @close voters (again, sorry): And in particular, if you look at the accepted answer, the workaround from "kdh" in the linked article (no longer on the same page as was linked, more comments have been added) is a solution to ensure that the full path is sent to the *server*. – T.J. Crowder Jun 10 '10 at 22:50
  • 1
    There's no real question in here. What 'file' is under discussion? – bmargulies Jun 11 '10 at 00:09
  • @bmargulies: Very good point, I assumed he meant from an `input type="file"`, but that was an assumption. – T.J. Crowder Jun 11 '10 at 06:57

1 Answers1

2

Basically, you can't, for security reasons.

However, the new/upcoming File API allows you to do just about everything you might want to do by getting the file's full path, without giving you the file's full path. You can read the file (yes, client-side), get a data-URI for it, etc. Example and details in this other question here on SO.

Community
  • 1
  • 1
T.J. Crowder
  • 1,031,962
  • 187
  • 1,923
  • 1,875
  • J. Maybe you want to post this answer on [the original question](http://stackoverflow.com/questions/81180/how-to-get-the-file-path-from-html-input-form-in-firefox-3), because this question will probably get deleted. – Daniel Vassallo Jun 10 '10 at 22:39
  • @Daniel: Thanks. I don't read that as a duplicate, I'll comment on the question to explain. – T.J. Crowder Jun 10 '10 at 22:43