swfupload在IE内核下错误一例,因为之前一直都是适用firefox,测试也是使用safari(香港那边同事用这个),结果今天测试swfupload上传时提示错误An error occurred in the upload. Try again later.但进度条却有进行...
debug代码为:
SWF DEBUG: SWFUpload Init Complete
SWF DEBUG:
SWF DEBUG: ----- SWF DEBUG OUTPUT ----
SWF DEBUG: Build Number: SWFUPLOAD 2.0.2 FP9 2008-01-07 0001
SWF DEBUG: movieName: SWFUpload_0
SWF DEBUG: Upload URL: ../../uploadsave.php?userid=5
SWF DEBUG: File Types String: *.mov;*.wmv;*.asf;*.asx;*.mpeg;*.avi;*.mpg;*.vob;*.mp4;*.3gp;*.rm;*.rmvb
SWF DEBUG: Parsed File Types: mov,wmv,asf,asx,mpeg,avi,mpg,vob,mp4,3gp,rm,rmvb
SWF DEBUG: File Types Description: Video Files (*.mov;*.wmv;*.asf;*.asx;*.mpeg;*.avi;*.mpg;*.vob;*.mp4;*.3gp;*.rm;*.rmvb)
SWF DEBUG: File Size Limit: 524288000 bytes
SWF DEBUG: File Upload Limit: 0
SWF DEBUG: File Queue Limit: 1
SWF DEBUG: Post Params:
SWF DEBUG: userid=5
SWF DEBUG: ----- END SWF DEBUG OUTPUT ----
SWF DEBUG:
----- SWFUPLOAD SETTINGS ----
ID: undefined
upload_url: ../../uploadsave.php?userid=5
file_post_name: video
post_params: {
userid: 5
}
file_types: *.mov;*.wmv;*.asf;*.asx;*.mpeg;*.avi;*.mpg;*.vob;*.mp4;*.3gp;*.rm;*.rmvb
file_types_description: Video Files
file_size_limit: 512000
file_upload_limit: 0
file_queue_limit: 1
flash_url: ./js/swfupload/swfupload_f9.swf
flash_width: 1px
flash_height: 1px
flash_color: #FFFFFF
debug_enabled: true
swfupload_element_id: flashUI
degraded_element_id: degradedUI
user_swfUploadLoaded_handler: function myShowUI() {
var btnSubmit = document.getElementById("btnSubmit");
btnSubmit.onclick = doSubmit;
btnSubmit.disabled = true;
SWFUpload.swfUploadLoaded.apply(this); // Let SWFUpload finish loading the UI.
validateForm();
}
----- SWFUPLOAD SETTINGS END ----
Flash called back and is ready.
SWF DEBUG: Event: fileDialogStart : Browsing files. Single Select. Allowed file types: *.mov;*.wmv;*.asf;*.asx;*.mpeg;*.avi;*.mpg;*.vob;*.mp4;*.3gp;*.rm;*.rmvb
SWF DEBUG: Select Handler: Files Selected from Dialog. Processing file list
SWF DEBUG: Event: fileQueued : File ID: SWFUpload_0_0
SWF DEBUG: Event: fileDialogComplete : Finished adding files
SWF DEBUG: StartUpload(): Starting Upload: First file in queue
SWF DEBUG: StartFile: First file in queue
SWF DEBUG: Event: uploadStart : File ID: SWFUpload_0_0
SWF DEBUG: Global Post Item: userid=5
SWF DEBUG: startFile(): File Reference found. File accepted by startUpload event. Starting upload to ../../uploadsave.php?userid=5 for File ID: SWFUpload_0_0
SWF DEBUG: Event: uploadProgress: File ID: SWFUpload_0_0. Bytes: 0. Total: 2758227
SWF DEBUG: Event: uploadProgress: File ID: SWFUpload_0_0. Bytes: 524288. Total: 2758227
SWF DEBUG: Event: uploadProgress: File ID: SWFUpload_0_0. Bytes: 2162688. Total: 2758227
SWF DEBUG: Event: uploadError : IO Error : File ID: SWFUpload_0_0. IO Error.
SWF DEBUG: Event: uploadComplete : Upload cycle complete.
在上传的配置文件里面有这样一句,说明可以用相对路径也可以用绝对url地址
upload_url: "../../uploadsave.php", // Relative to the SWF file, you can use an absolute URL as well.
使用相对路径时firefox,opera,safari都没有问题,而使用Internet Explorer 6(IE)和Internet Explorer 7(IE)以及Maxthon2(IE内核)均有错误提示An error occurred in the upload. Try again later.发现这是一个默认的错误
尝试将upload_url: "../../uploadsave.php", // Relative to the SWF file, you can use an absolute URL as well.改为绝对url地址后IE内核的也能正常使用了,像下面
upload_url: "http://localhost/works/uploadsave.php", // Relative to the SWF file, you can use an absolute URL as well.