这里我有demo.jsp页面,其中我有上传图像文件并提交表格,提交后转到servlethomepage,我需要获取上传的图片路径,我怎么能得到它?有人引导我请?
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>ImageResizing</title>
<script>
function validate() {
if (fileName.length == "") {
alert("Please Select Image");
}
else {
document.getElementById("uploadImgForm").submit();
}
}
</script>
</head>
<body>
<%
out.println("<form method='post' action='Result' enctype='multipart/form-data' id='uploadImgForm' name='uploadImgForm'>");
out.println("<table>");
out.println("<tr><td><input type='file' multiple='multiple' accept='image/*' id='Imgfile' name='Imgfile'></td></tr>");
out.println("<tr><td></td></tr>");
out.println("<tr><td><input type='button' value='Show Images' onclick='validate()'></td></tr>");
out.println("</table>");
out.println("</form>");
%>
</body>
如何在Result Servlet中选择图像路径,即C:\ users \ Pictures \ logo.jpg,对我有帮助吗?