這是我的設置。我自定義了upload_success_handler,然後文件始終處於上傳狀態,即使此文件已完全上傳。我該怎麼辦?爲什麼此設置使文件始終處於上載狀態,即使此文件已被完全上傳
var settings = {
flash_url : "/js/upload/swfupload.swf",
upload_url: "/includes/imgupload.php",
post_params: {"PHPSESSID" : "<?php echo session_id(); ?>","type":"post"},
file_size_limit : "5 MB",
file_types : "*.jpeg;*.jpg;*.png;*.gif",
file_types_description : "JPEG Images;JPG Images;PNG Images;GIF Images;",
file_upload_limit : 10,
file_queue_limit : 10,
custom_settings : {
progressTarget : "fsUploadProgress",
cancelButtonId : "btnCancel"
},
debug: false,
//Button
button_image_url: "images/TestImageNoText_65x29.png",
button_width: "65",
button_height: "29",
button_placeholder_id: "btn-upload",
button_text: '<span class="theFont">chose pictures</span>',
button_text_style: ".theFont { font-size: 12; }",
button_text_left_padding: 8,
button_text_top_padding: 3,
//The event handler functions are defined in handlers.js
file_queued_handler : fileQueued,
file_queue_error_handler : fileQueueError,
file_dialog_complete_handler : fileDialogComplete,
upload_start_handler : uploadStart,
upload_progress_handler : uploadProgress,
upload_error_handler : uploadError,
//upload_success_handler : uploadSuccess,
upload_success_handler : function(file,data){
document.getElementById("holder").innerHTML +="<li><img class='thumb' src='/includes/thumbnail.php?id="+data+"' style='max-width:400px;'></img>";
document.getElementById("holder").innerHTML +="<br><div>Pic"+item+"</div></li>";
parent.addImg(item,data);
item+=1;
setStats(file,COMPLETE);
},
upload_complete_handler : uploadComplete,
queue_complete_handler : queueComplete // Queue plugin event
};
iframe中的這個上傳器用於將圖片添加到編輯器中。 parent.addImg()用於將成功上傳的圖片傳遞給父窗口的編輯器。 var item只是一個計數器。感謝您的努力來解決我的問題和建議:)。我自己回答了這個問題,如果你有興趣,你可以看一眼。 – LotusH