joomla - Can't save filenames into the database with JInput -


i have form input fields of type text , file. have problem of filenames not saving in database else does. vardumped $myform , there files, created array filenames , merged $myform. tried set 'jform' doesn't seem working. have ideas why? thanks!

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

do not use $_post unless plan on writing extensive validation code secure user input.

instead, use $jinput->get('jform', null, 'raw');

this still apply validation, should keep values in tact.


Comments

Popular posts from this blog

Delphi XE2 Indy10 udp client-server interchange using SendBuffer-ReceiveBuffer -

Qt ActiveX WMI QAxBase::dynamicCallHelper: ItemIndex(int): No such property in -

Enable autocomplete or intellisense in Atom editor for PHP -