⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 myjsp.jsp

📁 网络硬盘
💻 JSP
字号:
<%@ page contentType="text/html; charset=gb2312" language="java"
	import="java.util.*" errorPage=""%>
<%@ page import="java.net.*" %>
<%
String path = request.getContextPath();
%>

<html locale="true">

	<head>

		<SCRIPT language=javascript>
function waitAndSubmit(){
	var waitdiv=document.getElementById("waitdiv");
	waitdiv.style.display="block";
}
function check_file() {
  var strFileName=document.forms(0).file;
  if (strFileName.value==""){
    alert("请选择要上传的文件");
    return false;
  }
  startProgress();

}

function loadmessage(){  

        <%

       if (request.getAttribute("message") != null) {

       %>  

           window.alert("<%=request.getAttribute("message")%>");

           window.returnValue="yes";

       <%}%>

}
function refreshProgress()
{
    UploadMonitor.getUploadInfo(updateProgress);
}
function updateProgress(uploadInfo)
{
    if (uploadInfo.inProgress)

    {
       document.getElementById('uploadbutton').disabled = true;
        document.getElementById('file').disabled = true;
        var fileIndex = uploadInfo.fileIndex;
        var progressPercent = Math.ceil((uploadInfo.bytesRead / uploadInfo.totalSize) * 100);
        document.getElementById('progressBarText').innerHTML = '文件读取进度: ' + progressPercent + '%';
        document.getElementById('progressBarBoxContent').style.width = parseInt(progressPercent * 3.5) + 'px';
        window.setTimeout('refreshProgress()', 1000);

    }
    else
    {
        document.getElementById('uploadbutton').disabled = false;
        document.getElementById('file').disabled = false;
    }
    return true;

}

 

function startProgress()
{
    document.getElementById('progressBar').style.display = 'block';
    document.getElementById('progressBarText').innerHTML = '文件读取进度: 0%';
    document.getElementById('uploadbutton').disabled = true;
    // wait a little while to make sure the upload has started ..
    window.setTimeout("refreshProgress()", 1000);
    return true;
}


</SCRIPT>

		<title>上传</title>

		<script src='<%=path%>/resources/js/upload.js'> </script>

		<script src='<%=path%>/dwr/interface/UploadMonitor.js'> </script>

		<script src='<%=path%>/dwr/engine.js'> </script>

		<script src='<%=path%>/dwr/util.js'> </script>

		<style type="text/css">

            #progressBar { padding-top: 5px; }

            #progressBarBox { width: 350px; height: 20px; border: 1px inset; background: #eee;}

            #progressBarBoxContent { width: 0; height: 20px; border-right: 1px solid #444; background: blue; }

        </style>

		<LINK href="<%=path%>/css/style.css" type="text/css" rel="stylesheet">



		<meta http-equiv="Content-Type" content="text/html; charset=gb2312">

	</head>

	<style type="text/css">

<!--

body {
    margin-left: 0px;
    margin-top: 0px;
    margin-right: 0px;
    margin-bottom: 0px;
}

-->

</style>

	<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"
		onLoad="loadmessage()">

		<form name="form" method="post"
			action="/webfile/file.do?actionId=upload"
			enctype="multipart/form-data" onsubmit="waitAndSubmit()">
			
			<table width="60%" border="0" cellspacing="1">

				<tr background-color=" #E7F5FE">

					<td width="30%" align="right">
						从文件导入:
					</td>

					<td width="51%">
						<input type="file" name="file" class="input">
						<input type="file" name="file1" class="input">
					</td>

					<td width="27%">
						<input type="submit" name="files" class="button_4"
							style="border-style:None;width:71px;" value="确定"
							id="uploadbutton">

					</td>

				</tr>

				<tr align="left" background-color=" #E7F5FE">

					<td colspan="3">

						<div id="progressBar" style="display: none;">



							<div id="theMeter">

								<div id="progressBarText"></div>

								<div id="progressBarBox">

									<div id="progressBarBoxContent"></div>

								</div>

							</div>

						</div>

					</td>

				</tr>

			</table>
			<div id="waitdiv" style="display:none">
				<table border="1" width="37%" cellspacing="0" cellpadding="4"
					style="border-collapse: collapse" bgcolor="#FFFFEC" height="87">
					<tr>
						<td bgcolor="#3399FF" style="font-size:12px;color:#ffffff"
							height=24>
							文件上传中...
						</td>
					</tr>
					<tr>
						<td style="font-size:12px;line-height:200%" align=center>
							文件正在上传处理中.请耐心等待...

							<marquee style="border:1px solid #000000" direction="right"
								width="300" scrollamount="5" scrolldelay="10" bgcolor="#ECF2FF">
								<table cellspacing="1" cellpadding="0">
									<tr height=8>
										<td bgcolor=#3399FF width=8></td>
										<td></td>
										<td bgcolor=#3399FF width=8></td>
										<td></td>
										<td bgcolor=#3399FF width=8></td>
										<td></td>
										<td bgcolor=#3399FF width=8></td>
										<td></td>
									</tr>
								</table>
							</marquee>
						</td>
					</tr>
				</table>
			</div>
		</form>
	<form action="" >
		<input type="checkbox">
	</form>
	<a href="/webfile/file.do?actionId=delete">delete</a>
	<a href="/webfile/file.do?actionId=download&downloadId=15">下载操作</a>
	<a href="../download.jsp?filePath=<%=URLEncoder.encode("C:/temp/tangkewei/济南水本价.doc","GBK")%>&fileName=<%=URLEncoder.encode("济南水本价.doc","GBK") %>">down</a>
	<a href="../download.jsp?fileName=<%=URLEncoder.encode("文档模版.rar","UTF-8")%>">shit!!!!!!!!!!!</a>
	 <script type="text/javascript">   
 	 function getFileSize()   
  	{   
         var filename=document.all('file1').value;   
          if(filename=='')   
          {   
             return false;   
          }   
          try {     
            var ado_stream=new ActiveXObject("ADODB.Stream");   
    		ado_stream.Type=1;//1=adTypeBinary;2   =   adTypeText   
    		ado_stream.Open();   
   			ado_stream.LoadFromFile(filename);//将文件信息存入流     
 			alert(ado_stream.Size);  
          }catch(e)   {   
        	alert("error"+e);   
            return   false;   
          }   
        
      return true;   
  }   
  </script>   
  <input   type=file   name="file1">   
  <input   type=button   onclick="getFileSize()">
	
	<script type="text/javascript">
	  function   getFileSize   (fileName)   {   
          window.oldOnError   =   window.onerror;   
          window.onerror   =   function   (err)   {   
              if   (err.indexOf('utomation')   !=   -1)   {   
                  alert('file   access   not   possible');   
                  return   true;   
              }   
              else     
                  return   false;   
          };   
          var   fso   =   new   ActiveXObject('Scripting.FileSystemObject');   
          var   file   =   fso.GetFile(fileName);   
          window.onerror   =   window.oldOnError;   
          return   file.Size;   
      }   
  function   showImageDimensions   ()   {   
      alert(this.width   +   'x'   +   this.height);   
  }   
  </SCRIPT>   
    
  </HEAD>   
  <BODY>   
  <FORM   NAME="formName">   
  <INPUT   TYPE="file"   NAME="fileName">   
  <BR>   
  <INPUT   TYPE="button"   VALUE="check"   ONCLICK="alert(getFileSize(this.form.fileName.value))">   
  </FORM> 
	
	
	
	
	<form method="post"
			action="/webfile/file.do?actionId=upload"
			enctype="multipart/form-data">
		<input type="file" name="f2" id="f2"/>
		<input type="submit" value="haha"/>
	</form>
	
	</body>

</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -