如何在Ajax上传上取得进度条

时间:2017-10-11 05:20:17

标签: javascript jquery

您好我正在使用Ajax Upload JS 3.5是否有办法在上传image / File时取得进展?我在网上看到的只是使用<input type="file">按钮而我的项目不是引导程序。

这是我目前的代码

jQuery(document).ready(function () {
var extension = "";
var btnUploadDrvr = $("#btnFitaDocBrowse");
var hidFilenameDrvr = $("#imgFitaDoc");
var hidDoccFrame = $("#frmFitaDoc");


InitAjaxUpload(btnUploadDrvr, hidFilenameDrvr, hidDoccFrame );

function InitAjaxUpload(btnUpload, imgHolder, hidDoccFrame) {
    new AjaxUpload(btnUpload, {
        action: '../UploadDownload/UploadLocalPic',
        data: '',
        name: 'uploadfile',
        onSubmit: function (file, ext) {
            extension = ext[0];
            if (!(ext && /^(jpg|png|jpeg|gif|pdf|PDF)$/.test(ext))) {
                alert("File format is not supported.");
                return false;
            }
        },
        onComplete: function (file, response) {
            //Add uploaded file to list
            if (response !== "failed") {
                    $("#frmFitaDoc").attr('src', 'data:application/pdf;base64,' + response);                   
            } 
        }
    });
}
});

我看到this这可以嵌入我的代码吗?。

0 个答案:

没有答案