MUI上传文件的方法

<!doctype html>
<html>

    <head>
        <meta charset="UTF-8">
        <title></title>
        <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
        <link href="css/mui.min.css" rel="stylesheet" />
    </head>

    <body>
        
        <button onclick="createUpload();">点我</button>
        
        <script src="js/mui.min.js"></script>
        <script type="text/javascript">
            mui.init()
            
            
            function createUpload() {
                console.log(111111111);
                var task = plus.uploader.createUpload( "http://47.94.245.189:807/abldoctor/upload/upload", 
                    { method:"POST",blocksize:204800,priority:100 },
                    function ( t, status ) {
                        // 上传完成
                        console.log(t);
                        if ( status == 200 ) { 
                            alert( "Upload success: " + t.url );
                        } else {
                            alert( "Upload failed: " + status );
                        }
                    }
                );
                task.addFile('images/touxiang2x.png', {key:"file"} );
                task.start();
            }
        </script>
    </body>

</html>

MUI上传文件的方法

posted @ 2018-01-08 13:24  波罗斯の程序日记  阅读(10019)  评论(1编辑  收藏  举报