Use FileUploader Code Snip

//ref

<link href="http://cdn.bootcss.com/file-uploader/3.7.0/fineuploader.css" rel="stylesheet">
<script src="http://cdn.bootcss.com/file-uploader/3.7.0/fineuploader.min.js"></script>
 <script src="http://cdn.bootcss.com/Cookies.js/0.3.1/cookies.min.js"></script>

//HTML

<div id="manual-fine-uploader">
</div>
<button id="triggerUpload" style="display:none">
</button>

//JS init Code

var manualuploader = new qq.FineUploader({
        element: document.getElementById("manual-fine-uploader"),
        request: {
            endpoint: baseUrl + 'reqType=addReportImage'
        },
        autoUpload: true,
        multiple: true,
        validation: {
            allowedExtensions: ['jpeg', 'jpg', 'txt'],
            sizeLimit: 9999999 //bytes
        },
        text: {
            uploadButton: '<i class="icon-plus icon-white"></i> Select Files'
        },
        callbacks: {
            onComplete: function (id, fileName, responseJSON) {
                $(".qq-upload-list").html("");
                //reloadData
                fetchShowImages(Cookies.get("resultReportId"));
            },
            onError: function (event, id, name, errorReason, xhrOrXdr) {
            },
        },
        debug: false
    });

    document.getElementById('triggerUpload').onclick = function () { 
        manualuploader.uploadStoredFiles();
    };

//behiden

 

posted @ 2013-12-28 17:44  HA-LOU  阅读(363)  评论(0编辑  收藏  举报