您现在的位置: 首页 > 开发编程 > HBuilder教程 > 正文

MUI上传文件案例分享

作者:admin来源:网络浏览:时间:2018-01-27 22:24:58我要评论
分享到
MUI上传文件案例分享

  1. <!doctype html> 
  2. <html> 
  3.  
  4.     <head> 
  5.         <meta charset="UTF-8"> 
  6.         <title></title> 
  7.         <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" /> 
  8.         <link href="css/mui.min.css" rel="stylesheet" /> 
  9.     </head> 
  10.  
  11.     <body> 
  12.          
  13.         <button onclick="createUpload();">点我</button> 
  14.          
  15.         <script src="js/mui.min.js"></script> 
  16.         <script type="text/javascript"> 
  17.             mui.init() 
  18.              
  19.              
  20.             function createUpload() { 
  21.                 console.log(111111111); 
  22.                 var task = plus.uploader.createUpload( "http://47.94.245.189:807/abldoctor/upload/upload",  
  23.                     { method:"POST",blocksize:204800,priority:100 }, 
  24.                     function ( t, status ) { 
  25.                         // 上传完成 
  26.                         console.log(t); 
  27.                         if ( status == 200 ) {  
  28.                             alert( "Upload success: " + t.url ); 
  29.                         } else { 
  30.                             alert( "Upload failed: " + status ); 
  31.                         } 
  32.                     } 
  33.                 ); 
  34.                 task.addFile('images/touxiang2x.png', {key:"file"} ); 
  35.                 task.start(); 
  36.             } 
  37.         </script> 
  38.     </body> 
  39.  
  40. </html> 

 

相关热词搜索: