开发者

SWFUpload Not Initialising

I've loaded the SWFUpload Javascript (confirmed the location is correct for all files loaded) and I've added the code to load a basic SWFUploader, but the problem is, I don't see any button. I don't see anything. Does the following code look correct?

<!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>


Try this out :

<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>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜