SwfUpload动态上传目录

时间:2011-01-24 12:15:19

标签: javascript jquery swfupload

onchange listbox事件

var url='';    
$('#vendor').change(function(){     
      var optionVal = $(this).val();
      if (optionVal=='') {       
          url=""; 

      } else {     
          url="../uploads/users/"+optionVal+"/items/"; 
      }
    });

我需要动态更改上传目录

swfu = new SWFUpload({

            upload_url: "../functions/class_uploads.php?action=general&destination=" + **url**,
            post_params: form_parameter,
            file_post_name: "Filedata",
            file_size_limit: "10 MB",
            file_types: "*.jpg;*.gif;*.png;*.bmp;*.flv;",
            file_types_description: "Doar fisiere: .jpg, .gif, .png, .bmp, .flv",
            file_upload_limit: "10",
            file_queue_limit: "0",

            swfupload_preload_handler : preLoad,
            swfupload_load_failed_handler : loadFailed,
            file_queue_error_handler : fileQueueError,
            file_dialog_complete_handler : fileDialogComplete,
            upload_progress_handler : uploadProgress,
            upload_error_handler : uploadError,
            upload_success_handler : uploadSuccess,
            upload_complete_handler : uploadComplete,   
            swfupload_loaded_handler: swfuploadLoaded,
            file_dialog_start_handler: fileDialogStart,
            file_queued_handler: fileQueued,
            file_queue_error_handler: fileQueueError,                
            upload_start_handler: uploadStart,
            upload_progress_handler: uploadProgress,                
            upload_success_handler: uploadSuccess,

            button_image_url : "../Styles/static/images/uploads/smallspyglass.png",
            button_placeholder_id : "spanButtonPlaceHolder",
            button_width: 180,
            button_height: 18,
            button_text : "<span class=\"button\">File<span class=\"buttonSmall\"><\/span><\/span>",
            button_text_style : '.button { font-family: Helvetica, Arial, sans-serif; font-size: 12pt; } .buttonSmall { font-size: 10pt; }',
            button_text_top_padding: 0,
            button_text_left_padding: 18,
            button_window_mode: SWFUpload.WINDOW_MODE.TRANSPARENT,
            button_cursor: SWFUpload.CURSOR.HAND,

            flash_url : "../js/uploads/flash/swfupload.swf",
            flash9_url : "../js/uploads/flash/swfupload_FP9.swf",

            custom_settings : {
            upload_dir : **url**,
            thumb : "../functions/class_thumbnail.php",
            progressTarget: "fsUploadProgress",
            thumbTarget: "thumbPreview",    
            cancelButtonId: "btnCancel",
            filesQueuedCount:"10",
            fileUploadNumber:"",
            delete_url: "../functions/class_delete.php",                   
            delete_url_error: "../functions/class_delete.php",
            submit_btn: "btn_submit",
            pkd: 1271043206,
            image_upload: 0,
            mixt_upload: 1 },         

            debug: false
       }); 

1 个答案:

答案 0 :(得分:1)

在开始上传之前执行swfu.setUploadURL('...');

http://demo.swfupload.org/Documentation/#setUploadURL