gpt4 book ai didi

javascript - SWFUpload 未初始化

转载 作者:行者123 更新时间:2023-11-28 10:09:52 26 4
gpt4 key购买 nike

我已经加载了 SWFUpload Javascript(确认加载的所有文件的位置都是正确的),并且添加了加载基本 SWFUploader 的代码,但问题是,我没有看到任何按钮。我什么也没看到。下面的代码看起来正确吗?

<!DOCTYPE html>
<html lang="en">
<head>

<script type="text/javascript" src="<?php echo base_url() ?>assets/fu/swfupload.js"> </script>

<script>
var swfu;

window.onload = function () {
var settings_object = {
upload_url : "<?php echo base_url() ?>index.php/upload",
flash_url : "<?php echo base_url() ?>assets/fu/Flash/swfupload.swf",
file_size_limit : "20 MB",
button_placeholder_id : "element_id",

button_width : 61,
button_height : 22,
button_text : "<b>Click</b> <span class="redText">here</span>",
button_text_style : ".redText { color: #FF0000; }",
button_text_left_padding : 3,
button_text_top_padding : 2,
button_action : SWFUpload.BUTTON_ACTION.SELECT_FILES,
button_disabled : false,
button_cursor : SWFUpload.CURSOR.HAND,
button_window_mode : SWFUpload.WINDOW_MODE.TRANSPARENT,
};

swfu = new SWFUpload(settings_object);
};
</script>
</head>
<body>
<h1>Upload Test</h1>
</body>
</html>

最佳答案

试试这个:

<script type="text/javascript">

var upload1;

window.onload = function() {
upload1 = new SWFUpload({
// Backend Settings
upload_url: "<?php echo base_url(); ?>youURL",
post_params: {session_id: '<?= session_id() ?>'},
// File Upload Settings
file_post_name: "resume_file",
file_size_limit: "10 MB", // 10MB
file_types: "*.jpg;",
file_types_description: "Allowed Types: ",
file_upload_limit: "1",
file_queue_limit: "0",
// Event Handler Settings (all my handlers are in the Handler.js file)
file_dialog_start_handler: fileDialogStart,
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: function() {
window.location = 'url_to_load_when_done'
},
// Button Settings
button_image_url: "/swf/XPButtonUploadText_61x22.png", // location that contains button image
button_placeholder_id: "spanButtonPlaceholder1",
button_width: 61,
button_height: 22,
// Flash Settings
flash_url: "/swf/swfupload.swf",
custom_settings: {
progressTarget: "fsUploadProgress1",
cancelButtonId: "btnCancel1"
},
// Debug Settings
debug: false
});
}
</script>

关于javascript - SWFUpload 未初始化,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7607095/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com