0

How to get a full native path of the file in String format which is being uploaded using and being used in a manged bean for its validation and upload? I also don't really want to use simple mode for p:fileUpload. For example, if a file is being uploaded is from desktop then I want the path of the file as "C:\Users\\Desktop\" in a String format.

Any help would be really appreciated...

  • There are about a dozen questions and answers in stackoverflow about this subject. I'm curious to what search terms you used and not finding any. I can then improve one of the duplicates so it might get found with your search criteria as well. Answer: you can't, not even in plain html. – Kukeltje Jun 19 '18 at 09:01
  • why is everybody just upvoting the possible duplicate comment instead of actually press the close button and mark it as a duplicate... – Kukeltje Jun 19 '18 at 09:40
  • @Kukeltje Possibly they have run out of close votes? – Mark Rotteveel Jun 20 '18 at 10:48

1 Answers1

-1

you can use java.nio.file.Path library

Path path = Paths.get("test.txt"); log("Path: " + path); log("Absolute: " + path.isAbsolute());

singh09iet
  • 11
  • 5
  • This would be the **server side** path, not the client-side one...you cannot (and should not) run java in a browser anymore – Kukeltje Jun 19 '18 at 09:39