HTMLä¸ä½¿ç¨input type="file"ä¸ä¼ æ件æ¶ï¼ä»£ç ä¸åªè½å¾å°æ件çå称ï¼èæäºç¹æ®çéè¦è¦æ±å¾å°ä¸ä¼ æ件çç»å¯¹è·¯å¾ï¼ä¸ºæ¤éç¨Javascriptå®ç°å¾å°æ件çç»å¯¹è·¯å¾ã
<form name="thisform" method="post"
action="<%=request.getContextPath()%>/movieManage.do" id="thisform" enctype="multipart/form-data">
<input type="file" name="theFile" onchange="document.getElementById('theFilePath').value=this.value"/>
<input type="hidden" id="theFilePath" name="theFilePath" value="">
</form>
注æï¼è¦æenctype="multipart/form-data"
Action代ç ï¼
String filePath = request.getParameter("theFilePath");
filePathæ¢æ¯ä¸ä¼ æ件çç»å¯¹è·¯å¾ã
æµè§å¨ä¸æµè¯ï¼
FirefoxåIEä¸å¯ä»¥å¾å°ç»å¯¹è·¯å¾ã
温馨提示:内容为网友见解,仅供参考