2010-10-19 62 views
0

我把瀏覽器放在我的jsp頁面,當我通過瀏覽器 選擇文件時,我在做一個System.outn選擇文件路徑,我只有名字, 和我需要的所有文件路徑選擇如何恢復所有選定的文件路徑

<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); 
+0

http://stackoverflow.com/questions/81180/how-to-get-the-file-path-from-html-input-form-in-firefox-3 – Bozho 2010-10-19 10:18:32

回答

1

你不能做到這一點,出於安全原因收回,從客戶機的文件路徑不顯示。 但是,如果確實需要獲取路徑,請不要依賴瀏覽器使用小程序。

1

這條路對你來說無濟於事,無一例外。此外,作爲隱私問題,在客戶機器上知道路徑並不是一個好主意。

相關問題