0

I have a problem with a JSP page. I have a type = "file".

<h4>Link:<input type="file" name="linkFile" value=""/></h4>

When in my servlet call the istruction:

System.out.printf(request.getParameter("linkFile"));

the return string is the name of the File and not the path.

There is a way to get a path and not only a file name.

Thanks.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
zp26
  • 1,507
  • 8
  • 20
  • 38
  • 2
    Duplicate of [How to get the file path from html input?](http://stackoverflow.com/questions/81180/how-to-get-the-file-path-from-html-input-form-in-firefox-3) To the point: you shouldn't be interested in the file path, but in the file content. Use Apache Commons FileUpload. – BalusC Jan 10 '11 at 18:41

1 Answers1

2

I think it's browser-dependent, some browsers send the whole path, some don't.

The file path is irrelevant in the server side anyway. If you want to upload a file, you should use multipart/form-data and the related functions.

Soufiane Hassou
  • 17,257
  • 2
  • 39
  • 75