From 61f1d30997f966079adae9447f9ad0b0c11c26ce Mon Sep 17 00:00:00 2001 From: yoqu Date: Tue, 21 Jun 2016 11:57:39 +0800 Subject: [PATCH] edit load files function, load more variable. override createProgress function , let it inject one array. when user delete file,let it inject array.but not only file name format:{name:"one.jpg",size:"1024",path:"/upload/"} --- js/jquery.uploadfile.js | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/js/jquery.uploadfile.js b/js/jquery.uploadfile.js index e5e6b8c..5a69bc8 100755 --- a/js/jquery.uploadfile.js +++ b/js/jquery.uploadfile.js @@ -195,19 +195,19 @@ } //This is for showing Old files to user. - this.createProgress = function (filename,filepath,filesize) { + this.createProgress = function (data) { var pd = new createProgressDiv(this, s); pd.progressDiv.show(); pd.progressbar.width('100%'); var fileNameStr = ""; - if(s.showFileCounter) - fileNameStr = obj.fileCounter + s.fileCounterStyle + filename; - else fileNameStr = filename; - - + if(s.showFileCounter) + fileNameStr = obj.fileCounter + s.fileCounterStyle + data['name']; + else fileNameStr = data['name']; + + if(s.showFileSize) - fileNameStr += " ("+getSizeStr(filesize)+")"; + fileNameStr += " ("+getSizeStr(data['size'])+")"; pd.filename.html(fileNameStr); @@ -215,26 +215,26 @@ obj.selectedFiles++; if(s.showPreview) { - pd.preview.attr('src',filepath); + pd.preview.attr('src',data['path']); pd.preview.show(); } - + if(s.showDownload) { pd.download.show(); pd.download.click(function () { - if(s.downloadCallback) s.downloadCallback.call(obj, [filename]); + if(s.downloadCallback) s.downloadCallback.call(obj, [data['name']]); }); } if(s.showDelete) { - pd.del.show(); - pd.del.click(function () { - pd.statusbar.hide().remove(); - var arr = [filename]; - if(s.deleteCallback) s.deleteCallback.call(this, arr, pd); - obj.selectedFiles -= 1; - updateFileCounter(s, obj); - }); + pd.del.show(); + pd.del.click(function () { + pd.statusbar.hide().remove(); + var arr = data; + if(s.deleteCallback) s.deleteCallback.call(this, arr, pd); + obj.selectedFiles -= 1; + updateFileCounter(s, obj); + }); } return pd;