Is it possible, having an HTML input type="file", to figure out the full path to the file selected in it from a Java applet?
The reason why I bother: signed applets can access file system, and browsers' file selectors are a lot nicer than Java swing one.Answer1:
You cannot. You're restricted by HTML/JS (and browser) security limitations. Officially, the value of
input type="file" should only return the filename, never the filepath. I am however surprised that Opera returns the full path, namely because MSIE was the only one I knew of who did it.
But as you're already running an applet, why don't you just make use of its capabilities? You can use <a href="http://java.sun.com/docs/books/tutorial/uiswing/components/filechooser.html" rel="nofollow">Swing's
JFileChooser</a> to select a file, exactly as you can do with HTML