addimage.jsp
上传用户:nbluoke
上传日期:2013-08-09
资源大小:4851k
文件大小:5k
源码类别:

教育系统应用

开发平台:

WORD

  1. <%@ page contentType="text/html; charset=gb2312" language="java" %>
  2. <%@ page import="java.util.*"%>
  3. <%@ page import="java.text.*"%>
  4. <%@ page  import="javazoom.upload.*,java.util.*" %>
  5. <jsp:useBean id="upBean" scope="page" class="javazoom.upload.UploadBean" >
  6.   <jsp:setProperty name="upBean" property="folderstore" value="D:testtesttestOnlinepic" />
  7. </jsp:useBean>
  8. <%/*
  9. String fname="";
  10. String sessionPic;
  11. String time1=request.getParameter("time1");
  12.         System.out.print("begin upload");
  13.       if (MultipartFormDataRequest.isMultipartFormData(request))
  14.       {
  15.         System.out.print("enter upload");
  16.          MultipartFormDataRequest mrequest = new MultipartFormDataRequest(request);
  17.                 Hashtable files = mrequest.getFiles();
  18.                 if ( (files != null) || (!files.isEmpty()) )
  19.                 {
  20.                     System.out.print("begin file");
  21.                      UploadFile file = (UploadFile) files.get("src");
  22.                     //out.println("<li>Form field : uploadfile"+"<BR> Uploaded file : "+file.getFileName()+" ("+file.getFileSize()+" bytes)"+"<BR> Content Type : "+file.getContentType());
  23.                     // Uses the bean now to store specified by jsp:setProperty at the top.
  24. fname=file.getFileName();
  25.     int num=fname.lastIndexOf(".");
  26.     int num1=fname.length();
  27.      String extname=fname.substring(num,num1);
  28.      fname=time1+extname;
  29.                     file.setFileName(fname);
  30.                     upBean.store(mrequest, "src");
  31.                 }
  32.                 else
  33.                 {
  34.                   System.out.println(" No uploaded files");
  35.                 }
  36.       }
  37.     */
  38. %>
  39. <HTML>
  40. <HEAD>
  41. <meta http-equiv="Content-Language" content="en-us">
  42. <meta name="GENERATOR" content="Microsoft FrontPage 5.0">
  43. <meta name="ProgId" content="FrontPage.Editor.Document">
  44. <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
  45. <STYLE type=text/css>TD {
  46. FONT-SIZE: 10.8pt
  47. }
  48. BODY {
  49. FONT-SIZE: 10.8pt
  50. }
  51. BUTTON {
  52. WIDTH: 6em; HEIGHT: 25px
  53. }
  54. INPUT {
  55. HEIGHT: 25px
  56. }
  57. TD {
  58. FONT-SIZE: 9pt
  59. }
  60. </STYLE>
  61. <title>插入图片</title>
  62. </HEAD>
  63. <%
  64. Date nowtime=new java.util.Date();
  65. SimpleDateFormat sf=new SimpleDateFormat("yyyyMMddHHmmssSSS");
  66. String shijian=sf.format(nowtime);
  67. %>
  68. <SCRIPT event=onclick for=Ok language=JavaScript>
  69.   filename=document.myform.src.value;
  70.   if (filename!="")
  71.   {
  72.   num=filename.lastIndexOf(".");
  73. num1=filename.length;
  74.   extname=filename.substring(num,num1);
  75.   window.returnValue = "pic/"+<%=shijian%>+extname+"*"+alt.value;
  76.   }
  77. </SCRIPT>
  78. <script>
  79. function checknull()
  80.   {if (document.myform.src.value=="")
  81.      {alert('请选择插入图片!');
  82.      return false;}
  83.    }
  84. </script>
  85. <BODY style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; FONT-SIZE: 9pt; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" bgColor=menu>
  86. <DIV align=center>
  87. <CENTER>
  88. <FORM name=myform action=SimpleUpload.jsp?time1=<%=shijian%>  method=post encType=multipart/form-data onsubmit="return checknull();">
  89. <TABLE cellSpacing=0 cellPadding=0 align=center border=0>
  90.   <TBODY>
  91.   <TR>
  92.     <TD height=30>
  93.       <DIV align=left valign="middle">图片来源(<U>P</U>): &nbsp;&nbsp;&nbsp;
  94.   <INPUT id=src type=file size=25 name=src valign="top">&nbsp;&nbsp;</DIV></TD>
  95.   <TD align=right>
  96.   <BUTTON type=submit id=Ok name=button1>上传</BUTTON></TD>
  97.     </TR>
  98.   <TR>
  99.     <TD height=30>
  100.       <DIV align=left valign="middle">替换文字(<U>T</U>): &nbsp;&nbsp;&nbsp;<INPUT
  101.       style="WIDTH: 260px" align=top name=alt id=alt>&nbsp;&nbsp; </DIV></TD>
  102.     <TD align=right><BUTTON id="close" onclick=window.close();>关闭</BUTTON> </TD></TR>
  103.   <TR>
  104.     <TD><BR>
  105.       <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
  106.         <TBODY>
  107.         <TR>
  108.           <TD width=215>
  109.             <FIELDSET style="HEIGHT: 86px"><LEGEND align=left>布局</LEGEND>
  110.             <TABLE>
  111.               <TBODY>
  112.               <TR>
  113.                 <TD align=middle height=25>&nbsp;对齐(<U>A</U>):
  114.                   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <SELECT
  115.                   name=align> <OPTION>不设置</OPTION> <OPTION
  116.                     value=left>左</OPTION> <OPTION value=right>右</OPTION> <OPTION
  117.                     value=textTop>文本上方</OPTION> <OPTION
  118.                     value=absMiddle>正中央</OPTION> <OPTION value=baseline
  119.                     selected>基线</OPTION> <OPTION value=absBottom>正下方</OPTION>
  120.                     <OPTION value=bottom>下</OPTION> <OPTION
  121.                     value=middle>中</OPTION> <OPTION
  122.                 value=top>上</OPTION></SELECT></TD></TR>
  123.               <TR>
  124.                 <TD>&nbsp;边框宽度(<U>B</U>):&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <INPUT
  125.                   style="WIDTH: 80px"
  126.           name=border></TD></TR></TBODY></TABLE></FIELDSET></TD>
  127.           <TD align=middle width=135>
  128.             <FIELDSET style="HEIGHT: 86px"><LEGEND align=left>间隔</LEGEND>
  129.             <TABLE>
  130.               <TBODY>
  131.               <TR>
  132.                 <TD vAlign=bottom>水平(<U>H</U>):&nbsp; <INPUT size=5
  133.                   name=hspace></TD></TR>
  134.               <TR>
  135.                 <TD vAlign=center>垂直(<U>V</U>):&nbsp; <INPUT size=5
  136.                   name=vspace></TD></TR></TBODY></TABLE></FIELDSET></TD></TR></TBODY></TABLE></TD>
  137.     <TD></TD></TR></TBODY></TABLE></FORM></CENTER></DIV></BODY></HTML>