2014年2月7日 星期五

upload6.jsp

<%@ page contentType="text/html" pageEncoding="UTF-8"%>
<%@ page import="java.util.*" %>
<%@ page import="java.text.DateFormat" %>
<%@ page import="java.sql.Connection" %>
<%@ page import="java.sql.DriverManager" %>
<%@ page import="java.sql.ResultSet" %>
<%@ page import="java.sql.SQLException" %>
<%@ page import="java.sql.Statement" %>
<%@ page import="java.sql.*" %>
<jsp:useBean scope="session" id="bean" class="com.erp.utils.CompanyProfile" />
<jsp:useBean scope="session" id="lingual" class="com.erp.utils.Lingual" />
<html>
<head>
<!-- span><%=bean.getCompanyName()%>:<%=bean.getDatabase()%></span -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="js/udf2.js"></script>
<title>File Uploading Form</title>
</head>
   
<%
String username="";
String mAlias="";
String recordid="";
String fieldName=request.getParameter("fieldName").trim();
String updateIMG=request.getParameter("updateIMG").trim();
//out.println(fieldName);
%>

<body>
<h3>File Upload:</h3>
Select a file to upload: <br />
<form id="upLoadForm" action="UploadServlet" method="post"
enctype="multipart/form-data">
<input type="file" name="file" id="file" size="50" />
<br />
<!-- input type="submit" value="Upload File" / -->
<button class="SaveButton" type="button" id="submit1" style="color:red;" >Upload</button>
<button class="SaveButton" type="button" onclick="parent.exitMoralBox();">Cancel</button>
</form>
</body>
<script>
$("#submit1").click(function(){  //subform.save.click
fullPath=_lookup("file");
if (fullPath){
$("#upLoadForm").submit();
file = fullPath.split('\\').pop();
s=file;


//window.parent.$('#'+updateIMG).prop('src','');
window.parent.document.getElementById("<%=updateIMG%>").src="data/"+s;
window.parent._refreshv2("<%=fieldName%>",s);

} else {
alert("No file had chooise.");
}
parent.exitMoralBox();
});
</script>
</html>

沒有留言:

張貼留言