本文整理汇总了PHP中JFTP::chmod方法的典型用法代码示例。如果您正苦于以下问题:PHP JFTP::chmod方法的具体用法?PHP JFTP::chmod怎么用?PHP JFTP::chmod使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JFTP
的用法示例。
在下文中一共展示了JFTP::chmod方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: set_permissions
private function set_permissions($filename, $permissions)
{
jimport("joomla.client.helper");
$ftp_config = JClientHelper::getCredentials('ftp');
if ($ftp_config['enabled']) {
jimport("joomla.client.ftp");
jimport("joomla.filesystem.path");
$jpath_root = JPATH_ROOT;
$filename = JPath::clean(str_replace(JPATH_ROOT, $ftp_config['root'], $filename), '/');
$ftp = new JFTP($ftp_config);
$result = intval($ftp->chmod($filename, $permissions));
} else {
$result = intval(@chmod($filename, $permissions));
}
$this->InstallLog->Write("setting permissions for [{$filename}]... [{$result}]");
return $result;
}
示例2: uploadFile
/**
* @param string The name of the php (temporary) uploaded file
* @param string The name of the file to put in the temp directory
* @param string The message to return
*/
function uploadFile($filename, $userfile_name, $msg)
{
$baseDir = JPATH_SITE . '/media';
if (file_exists($baseDir)) {
if (is_writable($baseDir)) {
if (move_uploaded_file($filename, $baseDir . $userfile_name)) {
if (JFTP::chmod($baseDir . $userfile_name)) {
return true;
} else {
$msg = JText::_('Failed to change the permissions of the uploaded file.');
}
} else {
$msg = JText::_('Failed to move uploaded file to <code>/media</code> directory.');
}
} else {
$msg = JText::_('Upload failed as <code>/media</code> directory is not writable.');
}
} else {
$msg = JText::_('Upload failed as <code>/media</code> directory does not exist.');
}
return false;
}