首页 > 其他分享 >layui文件上传重复问题

layui文件上传重复问题

时间:2022-10-16 21:32:21浏览次数:59  
标签:files function pt 重复 layui ppt var 上传 size


upload.render({
elem: '#add_ppts'
,url: localStorage.getItem('url') + '/upload/upload/ppt_upload'
,accept: 'video' //视频
,choose: function(obj){
// var files = obj.pushFile();
var files = this.files = obj.pushFile();
console.log(files)
obj.preview(function(index,file,result){
pt_name = file.name;
var size = parseInt(file.size)/1024;
size = size/1024;
pt_size = size;
})
}
,progress: function(e , percent) {
console.log("进度:" + percent + '%');
element.progress('progressBar',percent + '%');
}
,done: function(res,index){
console.log(res)
$("#fileName").val(res.data);
var ppt_html = '';
ppt_html +=
'<li>'+
' <h3 class="ppt_name"><img src="../../../layuiadmin/layui/images/ppt.png" alt=""><a href="">'+ pt_name +'</ a></h3>'+
' <p class="ppt_size fl">'+ pt_size +'</p >'+
' <div class="fr"><button type="button" class="layui-btn layui-btn-sm" onclick="add_ppt()">重传</button><button type="button" class="layui-btn layui-btn-sm layui-btn-danger" onclick="del_ppt()">删除</button></div>'+
'</li>';
$(".ppt_view").append(ppt_html);
delete this.files[index];
}
});

下面代码是关键

layui文件上传重复问题_重传

解决了问题,点击关注

标签:files,function,pt,重复,layui,ppt,var,上传,size
From: https://blog.51cto.com/course/5760556

相关文章