Как сохранить имя загруженного файла в базе данных

Прод. -Добавить загрузчик файлов в Joomla Admin Component

Я мог бы загрузить файл и сохранить его на диске. Но это не сохранение имени файла в базе данных.

Как мне это сделать ?

Вот контроллер -

class InvoiceManagerControllerInvoiceManager extends JControllerForm
{
    function save(){
        $file = JRequest::getVar('jform', null, 'files', 'array');
        $path = JPATH_BASE;

        // Make the file name safe.
        jimport('joomla.filesystem.file');
        $file['name']['invoice'] = JFile::makeSafe($file['name']['invoice']);

        // Move the uploaded file into a permanent location.
        if (isset($file['name']['invoice'])) {
            // Make sure that the full file path is safe.
            $filepath = JPath::clean($path. DS ."components". DS ."com_invoicemanager". DS ."files". DS .strtolower($file['name']['invoice']));
            // Move the uploaded file.
            JFile::upload( $file['tmp_name']['invoice'], $filepath );
        }

        return parent::save();
    }
}

Поле формы в XML -


ОБНОВЛЕНИЕ: работает после добавления следующих строк, взятых из @Andras Gera codeI '

$data = JRequest::getVar( 'jform', null, 'post', 'array' );
$data['invoice'] = strtolower( $file['name']['invoice'] );

JRequest::setVar('jform', $data );

Ответы на вопрос(5)

Ваш ответ на вопрос