123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <meta http-equiv="X-UA-Compatible" content="ie=edge">
- <title>Document</title>
- <style>
- .upload-btn {
- width: 130px;
- height: 25px;
- overflow: hidden;
- position: relative;
- border: 3px solid #06c;
- border-radius: 5px;
- background: #0cf;
-
- }
- .upload-btn:hover {
- background: #09f;
- }
- .upload-btn__txt {
- z-index: 1;
- position: relative;
- color: #fff;
- font-size: 18px;
- font-family: "Helvetica Neue";
- line-height: 24px;
- text-align: center;
- text-shadow: 0 1px 1px #000;
- }
- .upload-btn input {
- top: -10px;
- right: -40px;
- z-index: 2;
- position: absolute;
- cursor: pointer;
- opacity: 0;
- filter: alpha(opacity=0);
- font-size: 50px;
- }
- </style>
- <script src="../dist/jQuery.js"></script>
- <script>
-
- window.onload=function(){
- document.documentElement.focus()
- }
- </script>
- <script>
- var FileAPI = {
- // @default: "./dist/"
- staticPath: './dist/',
- // @default: FileAPI.staticPath + "FileAPI.flash.swf"
- flashUrl: './dist/FileAPI.flash.swf',
- // @default: FileAPI.staticPath + "FileAPI.flash.image.swf"
- flashImageUrl: './dist/FileAPI.flash.image.swf'
- };
- </script>
- <script src="../dist/FileAPI.js"></script>
- </head>
- <body>
- <div>
- <div class="js-fileapi-wrapper upload-btn">
- <div class="upload-btn__txt">Choose files</div>
- <input id="choose" name="uploadfile" type="file" multiple />
- </div>
- </div>
-
- <script>
- $(function(){
- $('iframe').bind( 'load', function(){} )
- FileAPI.debug = true
- $.support.cors = true;
- var choose = document.getElementById('choose');
- FileAPI.event.on(choose, 'change', function (evt){
- var files = FileAPI.getFiles(evt);
- FileAPI.filterFiles(files, function (file, info){
- return true;
- },
- function (files, rejected){
- if( files.length ){
- FileAPI.upload({
- dataType: 'string',
- url: 'http://192.168.2.236/api/icss/lisExcelRes/lisExcelAnalysis',
- files: {
- // 'hospitalCode':'A001',
- 'uploadfile': files[0]
- },
- headers:{
- // 'Content-Type':'Content-Type: multipart/form-data;'
- // 'Content-Type':'application/json;charset=UTF-8'
- // 'Content-type': "text/plain"
- },
- progress: function (evt){
- console.log(files,1111)
- alert(7)
- },
- complete: function (err, xhr){
- alert(9999)
- if( !err ){
- var result = xhr.responseText;
- alert(JSON.parse(result).code == 0?'成功':'失败')
- }else{
- alert(9)
- }
- }
- });
- }
- });
- });
- })
- </script>
- </body>
- </html>
|