【发布时间】:2013-03-22 09:00:30
【问题描述】:
我有一个带有文本和文件类型输入字段的表单。我有一个文件名没有保存在数据库中的问题,但其他一切都保存了。我对 $myForm 进行了转储,除了文件之外,一切都在那里,所以我用文件名创建了另一个数组,并将它与 $myForm 合并。然后我尝试将其设置为“jform”,但它似乎不起作用。有人对为什么有任何想法吗?谢谢!
controller.php
function save()
{
$jinput = JFactory::getApplication()->input;
$myForm = $jinput->get('jform', null, 'array');
//$files = $jinput->files->get('jform');
$file_array = ['image1' => 'test.png',
'image2' => 'test2.png'];
$merged_array = array_merge($myForm, $file_array);
$jinput->set('jform',$merged_array);
//or $jinput->post->set('jform',$merged_array); (this doesn't work either)
return parent::save();
}
【问题讨论】:
-
谢谢!最终使用 $_POST['jform'] = $merged_array;
标签: joomla save joomla2.5 jinput jform