input file

来源:互联网 发布:软件系统测试报告用途 编辑:程序博客网 时间:2024/05/18 03:19
 <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>upload.jsp</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">    
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<style type="text/css">
.a-upload {
   padding: 4px 10px;
   height: 20px;
   line-height: 20px;
   position: relative;
   cursor: pointer;
   color: #888;
   background: #fafafa;
   border: 1px solid #ddd;
   border-radius: 4px;
   overflow: hidden;
   display: inline-block;
   *display: inline;
   *zoom: 1;


}

.a-upload  input {
   position: absolute;
   font-size: 100px;
   right: 0;
   top: 0;
   opacity: 0;
   filter: alpha(opacity=0);
   cursor: pointer
}

.a-upload:hover {
   color: #444;
   background: #eee;
   border-color: #ccc;
   text-decoration: none
}
.a-a {
 margin:4px 6px;
 float:left;

}
</style>
<script type="text/javascript">
</script>
  </head>
  
  <body>  
 <form action="/oos/servlet/UploadFile" method="post" enctype="multipart/form-data">
   <div >
       <div class=" a-a">
    <input type="text" id="fileupload">
   </div>
   <div class="a-upload">
    <input type="file" id="fileField" name="fileUpload" onchange="document.getElementById('fileupload').value=this.value;" accept="text/html">浏览..</input></br>
       </div>
        <div >
    <input type="submit" value="提交">
        </div>   
   </div>
    
 </form>
  </body>
</html>


<input type="file" accept="application/msword" ><br><br>accept属性列表<br> 

1.accept="application/msexcel"
2.accept="application/msword"
3.accept="application/pdf"
4.accept="application/poscript"
5.accept="application/rtf"
6.accept="application/x-zip-compressed"
7.accept="audio/basic"
8.accept="audio/x-aiff"
9.accept="audio/x-mpeg"
10.accept="audio/x-pn/realaudio"
11.accept="audio/x-waw"
12.accept="image/gif"
13.accept="image/jpeg"
14.accept="image/tiff"
15.accept="image/x-ms-bmp"
16.accept="image/x-photo-cd"
17.accept="image/x-png"
18.accept="image/x-portablebitmap"
19.accept="image/x-portable-greymap"
20.accept="image/x-portable-pixmap"
21.accept="image/x-rgb"
22.accept="text/html"
23.accept="text/plain"
24.accept="video/quicktime"
25.accept="video/x-mpeg2"
26.accept="video/x-msvideo"


0 0
原创粉丝点击