相关疑难解决方法(0)

如何在数据库上保存上载的文件名

续 - 将文件上传器添加到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 …
Run Code Online (Sandbox Code Playgroud)

php joomla file-upload joomla2.5

4
推荐指数
1
解决办法
6056
查看次数

标签 统计

file-upload ×1

joomla ×1

joomla2.5 ×1

php ×1