im trying to use swfupload on my website and have followed all the instructions to the bone. now, when i select a file, all i see is pending.. it never goes any further. here is my implementation
var swfu = new SWFUpload({
upload_url : "urtupload.php",
flash_url : "swfupload/swfu开发者_StackOverflowpload.swf",
flash9_url : "swfupload/swfupload_fp9.swf",
post_params: {"PHPSESSID" : "<?php echo session_id(); ?>"},
file_size_limit : "100 MB",
file_types : "*.zip;*.arj;*.rar;*.tar.gz;*.tgz",
file_types_description : "All Files",
file_upload_limit : 100,
file_queue_limit : 1,
file_post_name : "Filedata",
custom_settings : {
progressTarget : "fsUploadProgress",
cancelButtonId : "btnCancel"
},
debug:false,
// Button settings
button_image_url: "images/ub.png",
button_width: "61",
button_height: "22",
button_placeholder_id: "spanButtonPlaceHolder",
button_text_style: ".theFont { font-size: 16; }",
button_text_left_padding: 12,
button_text_top_padding: 3,
moving_average_history_size: 40,
// The event handler functions are defined in handlers.js
// The event handler functions are defined in handlers.js
swfupload_preload_handler : preLoad,
swfupload_load_failed_handler : loadFailed,
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_complete_handler : uploadComplete,
queue_complete_handler : queueComplete
});
in your method: fileDialogComplete()
, ensure that you have the Javascript:
this.swfupload('startUpload');
This will tell your SWFU instance to start the uploads.
If you're using the example code (looks like you may be), be sure to also use/include the file 'handlers.js' (http://demo.swfupload.org/v220/simpledemo/js/handlers.js)
Good luck!
I had this problem after making my cancel button into a .NET control. Because .NET renamed the control, an error was being generated in fileDialogComplete and startUpload was never called. It's in a try/catch block, so it fails silently.
It's about the swfupload element being in a hidden div! As I have learned here: swfupload sometimes stuck on "Pending..."
Mostly it's not related to .NET or a missing startUpload() call (as the latter is a pretty standard function in any example).
You must have some id or class missing which you are using for styling. Because i faced the same issue which got fixed when i corrected the ids and classes given for progress bar, button etc.,
Flash Player 10: Because Flash Player 10 requires the SWFUpload swf to act is a button the movie must be visible in order for it to load. If the button_placeholder_id is set to an element that is hidden (visibility set to hidden or display set to none) SWFUpload will fail to load.
精彩评论