UploadFile1.jsp
资源名称:OA.rar [点击查看]
上传用户:mingda
上传日期:2017-06-20
资源大小:27691k
文件大小:3k
源码类别:
OA系统
开发平台:
Java
- <%@ page contentType="text/html; charset=GB2312" import="java.sql.*" import="java.lang.*" %>
- <%@ page import="java.io.*"%>
- <%@ page import="com.gforce.currency.clsupload.*"%>
- <html>
- <head>
- <title>文件上传</title>
- <SCRIPT LANGUAGE="JavaScript">
- function AddVar()
- {
- frmadd.CheckButton.value="ADD";
- var Nfile;
- if (frmadd.filea.value=="")
- {
- alert("请先选择文件,然后再上传!");
- }
- else
- {
- frmadd.CheckButton.value="ADD";
- frmadd.add.disabled=true;
- frmadd.ok.disabled=true;
- frmadd.submit();
- }
- }
- function finishVar()
- {
- window.top.returnValue="";
- window.top.close();
- }
- //-->
- </SCRIPT>
- </head>
- <%
- String destPathName = "/uploadfiles";
- String fileName="";
- if (request.getContentLength()>0)
- {
- ClsUpload upload=new ClsUpload(pageContext);
- if (upload.getValue("CheckButton").equals("ADD"))
- {
- fileName=upload.fileAdd("filea", destPathName);
- //fileName=new String(fileName.getBytes(), "ISO8859-1");
- //String fileExpandName = fileName.substring(fileName.lastIndexOf(".")+1);
- out.println("<script language="javascript">alert("上传成功!");window.top.returnValue=""+ fileName + "";window.top.close();</script>");
- }
- }
- %>
- <body leftmargin="0" topmargin="0">
- <table border="0" cellpadding="0" cellspacing="0" align="center" style="border:1px #6595D6 solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px;width:100%;">
- <tr>
- <td height="25" align="center" bgcolor="#6595D6"><font color="#0A0A0A" style="font-family: 宋体; font-size: 12px; line-height: 15px"><b>文件上传</b></font></td>
- </tr>
- <tr>
- <td>
- <form name="frmadd" method="post" enctype="multipart/form-data" action="">
- <table width="100%" align="center">
- <tr>
- <td align="left" valign="top"><font size="2">1、请点“<font color=red>浏览</font>”选择要上传的文件</font>
- </td>
- </tr>
- <tr>
- <td align="left" valign="top"> <input name="filea" type="file" size="28" onKeyDown="return false;">
- </td>
- </tr>
- <tr>
- <td align="left"><font size="2">2、点“<font color="#ff0000">上传</font>”按钮上传文件
- </font> <input type="submit" value="上传" name="add" onClick="javascript:AddVar()">
- <input type="button" name="ok" value="取消" onClick="javascript:finishVar()">
- <input type="hidden" name="CheckButton">
- </td>
- </tr>
- </table>
- </form>
- </td>
- </tr>
- </table>
- </body>
- </html>