var _upload = {}; _upload.total = 0; _upload.completed = 0; _upload.ismin = 1; _upload.tips = $('#upload_file_tips'); _upload.el = $('#uploading_file_list'); _upload.filelist = $('.fileList'); _upload.fid = null; var attachextensions = (_explorer.space.attachextensions.indexOf('|') != -1) ? _explorer.space.attachextensions.join('|') : _explorer.space.attachextensions; if (attachextensions == '') attachextensions = "\.*$"; else attachextensions = "(\.|\/)(" + (attachextensions) + ")$"; function fileupload(el,fid) { el.off(); el.fileupload({ url: _explorer.appUrl+'&do=ajax&operation=uploads&container=' + fid, dataType: 'json', autoUpload: true, maxChunkSize: parseInt(_explorer.space.maxChunkSize), //2M dropZone: el.attr('id')=='wangpan-upload-folder'?null:$('#middleconMenu'), pasteZone: el.attr('id')=='wangpan-upload-folder'?null:$('#middleconMenu'), maxFileSize: parseInt(_explorer.space.maxattachsize) > 0 ? parseInt(_explorer.space.maxattachsize) : null, // 5 MB acceptFileTypes: new RegExp(attachextensions, 'i'), sequentialUploads: true }).on('fileuploadadd', function (e, data) { data.context = $('
').appendTo(_upload.el); $.each(data.files, function (index, file) { $(getItemTpl(file)).appendTo(data.context); uploadadd(); _uploadheight(); }); }).on('fileuploadsubmit', function (e, data) { data.context.find('.upload-cancel').off('click').on('click', function () { data.abort(); data.files = ''; uploaddone(); $(this).parents('.dialog-info').find('.upload-cancel').hide(); $(this).parents('.dialog-info').find('.upload-file-status').html('' + __lang.already_cancel + ''); }); uploadsubmit(); $.each(data.files, function (index, file) { file.relativePath = (file.relativePath)?file.relativePath+file.name:''; var relativePath = (file.webkitRelativePath ? file.webkitRelativePath :file.relativePath); data.formData = {relativePath: relativePath}; return; }); }).on('fileuploadprocessalways', function (e, data) { var index = data.index, file = data.files[index]; if (file.error) { uploaddone(); data.context.find('.upload-item.percent').html('' + file.error + ''); } }).on('fileuploadprogress', function (e, data) { var index = data.index; _upload.bitrate = formatSize(data.bitrate / 8); var progre = parseInt(data.loaded / data.total * 100, 10); data.context.find('.process').css('width',progre + '%'); data.context.find('.upload-file-status .speed').html(_upload.bitrate + '/s'); data.context.find('.upload-file-status .precent').html(progre + '%'); }).on('fileuploadprogressall', function (e, data) { _upload.bitrate = formatSize(data.bitrate / 8); var progre = parseInt(data.loaded / data.total * 100, 10); uploadprogress(_upload.bitrate + '/s', progre + '%'); _upload.el.find('.panel-heading .upload-progress-mask').css('width', progre + '%'); }).on('fileuploaddone', function (e, data) { uploaddone(); // data.context.find('.upload-progress-mask').css('width',progre + '%'); // data.context.find('.upload-cancel').hide(); data.context.find('.upload-progress-mask').css('width', '0%'); data.context.find('.upload-cancel').hide(); var process_bar=data.context.find('.process').css('width', '100%'); if(process_bar){ data.context.find('.process').css('background-color','#fff'); } $.each(data.result.files, function (index, file) { if (file.error) { var relativePath = (file.relativePath ? file.relativePath : ''); data.context.find('.dialog-info .upload-file-status').html('' + file.error + ''); } else { _upload.tips.find('.dialog-body-text').html(_upload.completed + '/' + _upload.total); data.context.find('.upload-file-status .speed').html(''); data.context.find('.upload-file-operate').html('完成'); if(file.data.folderarr){ for(var i=0;i
';
var html =
'