Javascript使用SWFUpload进行多文件上传(2)

var uploadUrl='$!{request.uploadUrl}';//上传处理的url var savePath='$!{request.savePath}'; var fileType='$!{request.fileType}'; //var postName='$request.postName'; var sizeLimit='$!{request.sizeLimit}'; var uploadLimit='$!{request.uploadLimit}'; //var buttonWidth='$!{request.buttonWidth}'; //var buttonHeight='$!{request.buttonHeight}'; var buttonText='$!{request.buttonText}'; var buttonAlign='$!{request.buttonAlign}'; var componentHeight='$!{request.componentHeight}'; var showThumbnail='$!{request.showThumbnail}'; //是否显示缩略图,一般用于图片上传,默认为false var thumbnailScroll='$!{request.thumbnailScroll}';//缩略图部分是否显示滚动条 if(uploadUrl==''){ //uploadUrl='/Commons/fileUpload.do'; uploadUrl='/commons/paste.do?template=https://www.jb51.net/multifileupload/data/upload.htm'; } //if(postName=''){ // postName= "Filedata"; //} if(fileType==''){ fileType='*.*'; } if(uploadLimit==''){ uploadLimit=0; } //if(buttonWidth==''){ // buttonWidth=100; //} //if(buttonHeight==''){ // buttonHeight=22; //} if(buttonText==''){ buttonText='选 择 文 件'; } if(buttonAlign==''){ buttonAlign='left'; } if(showThumbnail==''){ showThumbnail=false; }else{ showThumbnail=true; } if(thumbnailScroll==''){ thumbnailScroll=false; }else{ thumbnailScroll=true; } if(uploadUrl.indexOf('?')!=-1){ uploadUrl=uploadUrl+'&savePath='+encodeURIComponent(savePath); }else{ uploadUrl=uploadUrl+'?savePath='+encodeURIComponent(savePath); } var swfu; window.onload = function () { swfu = new SWFUpload({ upload_url: uploadUrl, file_size_limit : sizeLimit, file_types : fileType, //file_types_description : "JPG Images", file_upload_limit : uploadLimit, // Zero means unlimited file_queue_error_handler : fileQueueError, file_dialog_complete_handler : fileDialogComplete, upload_progress_handler : uploadProgress, upload_error_handler : uploadError, upload_success_handler : uploadSuccess, upload_complete_handler : uploadComplete, button_image_url : "/modules/commons/view/multifileupload/images/XPButtonNoText_160x22.png", button_placeholder_id : "spanButtonPlaceholder", button_width: 101, button_height: 22, button_text : buttonText, button_text_style : '.button { font-family: 华文行楷,宋体, Arial, sans-serif; font-size: 14pt; } .buttonSmall { font-size: 10pt; }', button_text_top_padding: 1, button_text_left_padding: 20, flash_url : "/modules/commons/js/swfupload/swfupload.swf", custom_settings : { upload_target : "divFileProgressContainer" }, debug: false }); if(thumbnailScroll){ var divThumbnails=document.getElementById("thumbnails"); var divContent=document.getElementById("content"); divContent.style.width="400px"; divThumbnails.style.height='200px'; divThumbnails.style.overflowY="scroll"; divThumbnails.style.border="solid 1px #DDF0DD"; } document.getElementById("divButtonPlaceholder").style.textAlign=buttonAlign; if(componentHeight!=''){ componentHeight=componentHeight.replace("px",""); componentHeight=Number(componentHeight)-25;//去掉空隙和按钮高度 document.getElementById("fsProgress").style.height=componentHeight+"px"; } }

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wzzfjp.html