python上传文件进度_上传多个文件并显示进度栏

我正在一个项目(在Django中)中创建一个页面,以添加有关文件的数据信息,然后添加文件本身。

JFzC8.png

单击“更多数据集”按钮时,它将添加另一个字段以上传另一个文件。

jB5cr.png

可以一次性添加最终用户所需数量的文件。

我需要的是一旦单击“上传数据集”并应该显示单个进度条,就上传所有附件。

到目前为止,我已经看完了多个教程,但是使用Vitor Freitas的教程有点接近。

JS代码:

$(function(){

/*$("#add_new_dataset").click(function(){

$(".file").click();

});*/

$(".file").fileupload({

dataType: 'json',

sequentialUploads: true, /* Send the files one by one */

start: function(e){ /* When the upload process starts, show the modal */

$("#modal-progress").modal("show");

},

stop: function(e){ /* When the upload progress finalizes, hide the modal */

$("#modal-progress").modal("hide");

},

progressall: function(e, data){ /* Update the progress bar */

var progress = parseInt(data.loaded / data.total * 100, 10),

strProgress = progress + "%";

$(".progress-bar").css({"width": strProgress});

$(".progress-bar").text(strProgress);

},

done: function(e, data){

if(data.result.is_valid){

$("#gallery tbody").prepend(

"

" + data.result.name + ""

);

}

}

})

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值