📄 upload_b.jsp
字号:
<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="../../include.jsp"%>
<html>
<head>
<base target="top">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>上传图片</title>
<%
if ( request.getMethod().equalsIgnoreCase("post") )
{
String name = productMgr.uploadImg(request);
out.println("<script>");
if ( name.indexOf(".") > 0)
{
out.println("window.returnValue='" + name + "'");
out.println("window.close()");
}
else
{
out.println("alert('" + name + "')");
}
out.println("</script>");
}
%>
<script>
function checkF(theForm)
{
if (theForm.file.value=="")
{
alert("请选择图片");
return(false);
}
return(true);
}
function prev(src)
{
var imgObj = new Image();
imgObj.src=src;
document.getElementById("prev_img").innerHTML="<img width='100' height='100' src='"+src+"' id='prev_img'>";
document.getElementById("img_size").innerHTML=imgObj.width +" x "+imgObj.height;
}
</script>
<link href="../comm.css" rel="stylesheet" type="text/css">
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="100%" border="0" cellpadding="0" cellspacing="5">
<form action="" method="post" enctype="multipart/form-data" name="form1" onSubmit="return checkF(this)" target="_self">
<tr>
<td width="19%" height="100" align="center">预览</td>
<td width="40%"><span id="prev_img"></span></td>
<td width="41%" align="center" valign="middle">尺寸<br>
<br>
<span id="img_size"></span></td>
</tr>
<tr>
<td colspan="3"> <input name="file" type="file" onChange="prev(this.value)" size="15">
<input name="Submit" type="submit" class="short-button" value=" 上 传 "> </td>
</tr>
</form>
</table>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -