views:

13

answers:

2

Hello,

I put a browser in my jsp page, and when I select the file via the browser and I'm doing a System.outn select the file path, I only have the name, and I need to recover all the file path selected

<form:form onsubmit="document.getElementById('idButton').value='Traîtement en cours ...'" action="ajouter.html"
           method="POST">



                <input type="file" name="cible">

                <input type="submit" id="idButton" name="ajouter" value="Ajouter" tabindex="50"/>

</form:form>


(ActionForm)

 String leChemin = (String) request.getParameter("cible");
 System.out.println("leChemin = " + leChemin);
+1  A: 

You cannot do this, for security reasons, file path from clients are not shown. But if really need to get the path, do not rely on the browser use applet.

jerjer
+1  A: 

The path would be useless for you, none the less. Moreover, as a privacy concern, its not really a good idea to know the path at client's machine.

Adeel Ansari