AddAccessory1.jsp
上传用户:mingda
上传日期:2017-06-20
资源大小:27691k
文件大小:3k
源码类别:

OA系统

开发平台:

Java

  1. <%@ page contentType="text/html; charset=GB2312" import="java.sql.*" import="java.lang.*" %>
  2. <%@ page import="java.io.*"%>
  3. <%@ page import="com.gforce.currency.clsupload.*"%>
  4. <html>
  5. <head>
  6. <title>新增附件</title>
  7. <SCRIPT LANGUAGE="JavaScript">
  8.     function AddVar()
  9.     {
  10.         frmadd.CheckButton.value="ADD";
  11.         var Nfile;
  12.         if (frmadd.filea.value=="")
  13.         {
  14.             alert("请先选择文件,然后再上传!");
  15.         }
  16.         else
  17.         {
  18.             frmadd.CheckButton.value="ADD";
  19.             frmadd.add.disabled=true;
  20.             frmadd.ok.disabled=true;
  21.             frmadd.submit();
  22.         }
  23.     }
  24.     function finishVar()
  25.     {
  26.         window.top.returnValue="";
  27.         window.top.close();
  28.     }
  29. //-->
  30. </SCRIPT>
  31. </head>
  32. <%
  33.     String destPathName = "/uploadfiles";
  34.     String fileName="";
  35.     if (request.getContentLength()>0)
  36.     {
  37.         ClsUpload upload=new ClsUpload(pageContext);
  38.         if (upload.getValue("CheckButton").equals("ADD"))
  39.         {
  40.             fileName=upload.uploadFile("filea", destPathName);
  41.             out.println("<script language="javascript">alert("上传成功!");window.top.returnValue=""+ fileName + "";window.top.close();</script>");
  42.         }
  43.     }
  44. %>
  45. <body leftmargin="0" topmargin="0">
  46. <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%;">
  47.   <tr>
  48.     <td height="25" align="center" bgcolor="#6595D6"><font color="#0A0A0A" style="font-family: 宋体; font-size: 12px; line-height: 15px"><b>文件上传</b></font></td>
  49.   </tr>
  50.   <tr>
  51.     <td>
  52.       <form name="frmadd" method="post" enctype="multipart/form-data" action="">
  53.         <table width="100%" align="center">
  54.           <tr>
  55.             <td align="left" valign="top"><font size="2">1、请点“<font color=red>浏览</font>”选择要上传的文件</font>
  56.             </td>
  57.           </tr>
  58.           <tr>
  59.             <td align="left" valign="top"> <input name="filea" type="file" size="28" onKeyDown="return false;">
  60.             </td>
  61.           </tr>
  62.           <tr>
  63.             <td align="left"><font size="2">2、点“<font color="#ff0000">上传</font>”按钮上传文件
  64.               </font> <input type="submit" value="上传" name="add" onClick="javascript:AddVar()">
  65.               <input type="button" name="ok" value="取消"  onClick="javascript:finishVar()">
  66.               <input type="hidden" name="CheckButton">
  67.             </td>
  68.           </tr>
  69.         </table>
  70.       </form>
  71.     </td>
  72.   </tr>
  73. </table>
  74. </body>
  75. </html>