How to upload a file to joomla?

Hi, I am making a simple component in Joomla that has detailed image information, and I need to download this image, how can I load an image from the backend. which is better to use the extension or make custom. can you share any good article for this. I searched a lot more, but due to the lack of an idea about Joomla can not find. hope the brilliant guys help me.

thanks, i'm moving forward

+5
source share
5 answers

The Joomla component for the exact scenario of your requirement will be very difficult to find out. Thus, you have two options: 1. Make your own component 2. Configure another similar type of component, for example, a gallery component

To upload a file from the joomla component to admin, if you create your own component: 1. Just use the move_uploaded_filephp function . 2. Copy this code for the joomla fxn standard:

    function upload($src, $dest)
    {
        jimport('joomla.client.helper');
        $FTPOptions = JClientHelper::getCredentials('ftp');
        $ret            = false;
        $dest = JPath::clean($dest);
        $baseDir = dirname($dest);
        if (!file_exists($baseDir)) {
                jimport('joomla.filesystem.folder');
                JFolder::create($baseDir);
        }

        if ($FTPOptions['enabled'] == 1) {
                jimport('joomla.client.ftp');
                $ftp = & JFTP::getInstance($FTPOptions['host'], $FTPOptions['port'], null, $FTPOptions['user'], $FTPOptions['pass']);
                $dest = JPath::clean(str_replace(JPATH_ROOT, $FTPOptions['root'], $dest), '/');
                if (is_uploaded_file($src) && $ftp->store($src, $dest))
                {
                            $ret = true;
                        unlink($src);
                } else {
                        JError::raiseWarning(21, JText::_('WARNFS_ERR02'));
                }
        } else {
                if (is_writeable($baseDir) && move_uploaded_file($src, $dest)) { // Short circuit to prevent file permission errors
                        if (JPath::setPermissions($dest)) {
                                $ret = true;
                        } else {
                                JError::raiseWarning(21, JText::_('WARNFS_ERR01'));
                        }
                } else {
                        JError::raiseWarning(21, JText::_('WARNFS_ERR02'));
                }
        }
        return $ret;
}

If you want to use another component and edit it as needed, download it: http://prakashgobhaju.com.np/index.php?option=com_showcase_gallery&view=items&catid=1&Itemid=64 Remember that this is a gallery component.

+4
source

, Joomla, FTP FTP-, filezilla, , , . -, , 000webhost, , . public_html, "". , .

joomla, FTP-, filezilla, , filezilla, , , "".

, http://www.thekonsulthub.com/how-tos/how-to-upload-joomla-with-filezilla-to-your-hosting-servers-cpanel/ { }

0

, , , , MediaHelper. , , , , , , html javascript . , MediaHelper:: canUpload, . - . , , . -, . API, Joomla, , -.

0
source

just clear your cheers cache and try again ...

-1
source

All Articles