SwfUpload动态上传目录

发布于 2024-10-14 13:41:12 字数 3055 浏览 2 评论 0原文

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
       }); 

onchange listbox event

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

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

I need dynamicaly change upload directory

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
       }); 

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

弥繁 2024-10-21 13:41:12

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

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

Do swfu.setUploadURL('...'); before starting the upload.

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文