如何在joomla中上传文件?

编程入门 行业动态 更新时间:2024-10-26 00:20:56
本文介绍了如何在joomla中上传文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在 joomla 中制作一个具有名称图像详细信息的简单组件,我必须上传该图像,如何从后端上传图像.使用扩展或自定义哪个更好.你能分享任何好的文章吗?我已经搜索了更多,但由于缺乏对 joomla 的了解而无法找到.希望各位天才帮帮我.

Hi i am making a simple component in joomla having name image detail and i have to upload that image how can i upload image from backend. which one is better using extension or make custom. can you please share any good article for it. i have searched many more but due to lack of idea on joomla cannot find. hope you genius guys help me.

谢谢我提前

推荐答案

Joomla 组件对于您的需求的确切场景将很难找到.所以你有两个选择:1. 制作自己的组件2. 自定义图库组件等其他类似类型的组件

Joomla Component for the exact scenario of your requirement will be very hard to find out. So you've two options: 1. Make your own component 2. Customize other similar type of component like gallery component

如果您正在制作自己的组件,则用于从管理员上的 joomla 组件上传文件:1. 只需使用move_uploaded_file php 函数.2. 复制此代码,用于 joomla 的标准 fxn :

For uploading file from joomla component on admin if you're making your own component: 1. Just use move_uploaded_file php function. 2. copy this code, for joomla's standard fxn :

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

如果你想使用别人的组件并根据需要编辑它,下载它:prakashgobhaju.np/index.php?option=com_showcase_gallery&view=items&catid=1&Itemid=64记住它是一个画廊组件.

If you want to use other's component and edit it according to need, download it: prakashgobhaju.np/index.php?option=com_showcase_gallery&view=items&catid=1&Itemid=64 Remember it's a gallery component.

更多推荐

如何在joomla中上传文件?

本文发布于:2023-10-29 04:11:57,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1538686.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:上传文件   如何在   joomla

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!