post param用于SWFUpload?

时间:2010-11-29 11:16:22

标签: php flash swfupload

嗨,有人可以解释如何在SWFUpload中使用post_param。我需要在提交时加载name ='batchid'的值。这就是示例文档显示的内容

post_params : {
    "post_param_name_1" : "post_param_value_1",
    "post_param_name_2" : "post_param_value_2",
    "post_param_name_n" : "post_param_value_n"
},

2 个答案:

答案 0 :(得分:1)

你试过了吗?

post_params : {
    "name" : "batchid"
}

如果batchid是一个变量(我猜是这样),用你的php定义它并将其称为普通的js var:

post_params : {
    "name" : batchid
}

答案 1 :(得分:0)

初始化SWFUPLOAD后添加POST变量:

        var form = document.adminForm;
        if (form.catid.value == "0"){
    alert( "<?php echo JText::_( 'You must select a category', true ); ?>" );
       } else {
          var radio =  $('adminForm').value;    
          upload1.addPostParam("published" ,radio),
          upload1.addPostParam("cat_id" , document.adminForm.catid.value );
          upload1.addPostParam("MAX_FILE_SIZE" ,"5000000" );
          upload1.addPostParam("UPLOAD_MAX_FILESIZE" ,"5000000" );
      upload1.startUpload();
      }


            var upload1;
        window.onload = function() {
    upload1 = new SWFUpload({
    post_params: {},
        upload_url: "upload.php", 
            file_size_limit : "1024",
             ...

             })