-1

I have jsp code and servlet I write code in jsp for browsing files of local machiene (files of users)

 <input name="f" type="file" style=" -moz-background-size: 50" size="50" maxlength="30" > 

when I get the path of file in servlet page

f=  new String(request.getParameter("f").getBytes("iso-8859-1"), "UTF-8"); 

With Firefox and Chrome I can not get the path because of security. Can I change the security setting of browsers to get the path nevertheless?

Wladimir Palant
  • 56,865
  • 12
  • 98
  • 126
  • You could write an applet mimicking a file input. Then the security degradation can be prompted to the user automatically. – Joop Eggen May 15 '12 at 09:13
  • possible duplicate of [How to get the file path from HTML input form in Firefox 3](http://stackoverflow.com/questions/81180/how-to-get-the-file-path-from-html-input-form-in-firefox-3) – BalusC May 15 '12 at 20:40
  • and equivalently [How to upload files in JSP/Servlet?](http://stackoverflow.com/questions/2422468/how-to-upload-files-in-jsp-servlet/2424824#2424824) – BalusC May 15 '12 at 20:40

1 Answers1

0

Maybe the browsers have a reason to not let you access the path name of the file to prevent information leaks.

There has been quite some concern about this, and this is why this security measure was put into place. If you could just disable it, they could have skipped that completely. That would be a bug in the browser if you could...

Has QUIT--Anony-Mousse
  • 76,138
  • 12
  • 138
  • 194