📄 fileupload.jsp
字号:
<%@ page contentType="text/html;charset=GBK"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
String contextPath=request.getContextPath();
System.out.print(request.getParameter("product_pic") + "=================");
String product_pic = "cover.jpg";
if(request.getParameter("product_pic") != null && !"".equals(request.getParameter("product_pic")))
product_pic = request.getParameter("product_pic");
%>
<script>
parent.frm.attr4.value = "<%=product_pic%>";
function frmSubmit()
{
if(frm.picPath.value == null || frm.picPath.value == "")
{
alert('请选择上传文件');
return;
}
frm.submit();
}
</script>
<form name="frm" action="../../product/fileUpload" method="post" enctype="multipart/form-data">
<table>
<tr>
<td>
<img src="<%=contextPath%>/productPic/<%=product_pic%>" width="95" height="119">
</td>
<td>
<input type="file" name="picPath">
</td>
<td>
<input type="button" value="上传" onclick="frmSubmit()">
</td>
</tr>
</table>
</form>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -