2013-03-12 40 views
0

我需要编辑下列表格,以便将具有附加文件功能:PHP安装

function _getWriteForm() 
{ 
    $aForm = array(
     'form_attrs' => array(
      'name' => 'WallPostText', 
      'action' => BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . 'post/', 
      'method' => 'post', 
      'enctype' => 'multipart/form-data', 
      'target' => 'WallPostIframe', 
      'onsubmit' => 'javascript:return ' . $this->_sJsPostObject . '.postSubmit(this);' 
     ), 
     'inputs' => array(
      'content' => array(
       'type' => 'textarea', 
       'name' => 'content', 
       'caption' => '', 
       'colspan' => true 
      ), 
      'submit' => array(
       'type' => 'submit', 
       'name' => 'submit', 
       'value' => _t('_wall_post'), 
       'colspan' => true 
      ) 
     ), 
    ); 

我想先编辑HTML文件,但这样做的唯一的HTML代码是:

<!-- Post Text --> 
<div class="wall-ptype-cnt wall_text">__post_wall_text__</div> 

有人可以帮我编辑数组,以允许文件附件? 谢谢。

回答

0

你应该尝试这样的事:

function _getWriteForm() 
{ 
$aForm = array(
    'form_attrs' => array(
     'name' => 'WallPostText', 
     'action' => BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . 'post/', 
     'method' => 'post', 
     'enctype' => 'multipart/form-data', 
     'target' => 'WallPostIframe', 
     'onsubmit' => 'javascript:return ' . $this->_sJsPostObject . '.postSubmit(this);' 
    ), 
    'inputs' => array(
     'content' => array(
      'type' => 'textarea', 
      'name' => 'content', 
      'caption' => '', 
      'colspan' => true 
     ), 
     'file' => array(
      'type' => 'file', 
      'name' => 'upload_file', 
      'caption' => 'Upload', 
      'colspan' => true 
     ), 
     'file_two' => array( //I added a second input file 
      'type' => 'file', 
      'name' => 'upload_file_two', 
      'caption' => 'Upload', 
      'colspan' => true 
     ), 
     'submit' => array(
      'type' => 'submit', 
      'name' => 'submit', 
      'value' => _t('_wall_post'), 
      'colspan' => true 
     ) 
    ), 
); 

我希望它能帮助。

Saludos;)

+0

非常感谢,它确实工作,但可以上传多个?因为它只允许选择1个文件上传。对不起,我没有在我的问题中提及。 – yyvskiy 2013-03-12 20:59:34

+0

是的....它可以是多个.....你应该简单地复制文件数组,如file1,file2等....只是简单的复制粘贴;)....我编辑我的答案....等 – Hackerman 2013-03-12 21:09:07

+0

很多感谢你再次罗伯特,它真的工作,对我在未来的工作,以及对我非常有用:) – yyvskiy 2013-03-12 21:44:17