Moment For Technology

Duplicate layui file upload problem

Posted on Aug. 8, 2022, 7:04 p.m. by 許柏翰
Category: The front end Tag: javascript
upload.render({ elem: '#add_ppts' ,url: localStorage.getItem('url') + '/upload/upload/ppt_upload' ,accept: Function (obj){// var files = obj.pushFile(); var files = this.files = obj.pushFile(); console.log(files) obj.preview(function(index,file,result){ pt_name =; var size = parseInt(file.size)/1024; size = size/1024; pt_size = size; },progress: function(e, percent) {console.log(" percent: "+ percent + '%'); element.progress('progressBar',percent + '%'); } ,done: function(res,index){ console.log(res) $("#fileName").val(; 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()" Onclick ="del_ppt()" delete /button/div'+ '/li'; $(".ppt_view").append(ppt_html); delete this.files[index]; }});Copy the code

The following code is the key

About (Moment For Technology) is a global community with thousands techies from across the global hang out!Passionate technologists, be it gadget freaks, tech enthusiasts, coders, technopreneurs, or CIOs, you would find them all here.