1

我有一个工作正常的上传系统。我使用 Swfobject 直接上传到 amazon s3。我的系统将文件保存在相应的用户文件夹中。如果用户 A 上传,它将上传 A/,当用户 B 上传时,它将上传到 B/ 文件夹。总而言之,一切都很好,除了。我需要根据他们填写的可能的 html 表单来更改文件名。这可以做到吗?可能通过Javascript或JQuery?

这是我的代码

<script type="text/javascript">

    var isMacUser = false;
    var successURL = 'http://dummy.com/dummy/filelist.php';

        var swfu;

        window.onload = function() {
            var settings = {
                flash_url : "swfupload/swfupload.swf",
                flash9_url : "swfupload/swfupload_fp9.swf",
                //upload_url: "upload.php",
        upload_url: "http://dummy.s3.amazonaws.com/",
        post_params: {"AWSAccessKeyId":"THIS IS ACCESSKEY", "key":"UsernamePHPEcho/${filename}", "acl":"public-read", "policy":"GIBBERISH GOES HERE", "signature":"a/thBERU0dLtd6r+QvRbUJEvMxU=","success_action_status":"201", "content-type":"image/"},

        http_success : [201],
        assume_success_timeout : 0,


        // File Upload Settings
        file_post_name: 'file',
        file_size_limit : "100 MB",    // 100 MB
        file_types : "*.*",
        file_types_description : "All Files",
        file_upload_limit : "10",
        file_queue_limit : 3,

                custom_settings : {
                    progressTarget : "fsUploadProgress",
                    cancelButtonId : "btnCancel"
                },
                debug: false,

                // Button Settings
        button_placeholder_id : "spanButtonPlaceholder",
        button_width: 61,
        button_height: 22,
        button_window_mode: SWFUpload.WINDOW_MODE.TRANSPARENT,
        button_cursor: SWFUpload.CURSOR.HAND,



        moving_average_history_size: 10,

                // 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  // Queue plugin event
            };

            swfu = new SWFUpload(settings);
         };
    </script>
4

0 回答 0