在servlet中,我想得到jsp表单上传的文件的硬盘的绝对路径,但是由于浏览器的安全性原因,只能得到文件名,不能得到全路径,使我无法用new file(filepath)创建文件。
如jsp中:
<form action="servlet/ManageAlbum?sub=UPLOAD" method="post">
<input type="file" name="filepath" id="filepath" />
<input type="submit" value="upload"/>
</form>
在servlet中用filepath=request.getParameter("filepath");报错,因为filepath只是文件名,不是路径名。
请问jsp该如何向servlet中传一个文件输入流?