本文整理匯總了PHP中files::tidyFileName方法的典型用法代碼示例。如果您正苦於以下問題:PHP files::tidyFileName方法的具體用法?PHP files::tidyFileName怎麽用?PHP files::tidyFileName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類files
的用法示例。
在下文中一共展示了files::tidyFileName方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: name
/**
Creates a file from binary content.
@param name <b>string</b> File name (relative to working directory)
@param bits <b>string</b> Binary file content
*/
public function uploadBits($name, $bits)
{
if (!$this->core->auth->check('media,media_admin', $this->core->blog->id)) {
throw new Exception(__('Permission denied.'));
}
$name = files::tidyFileName($name);
parent::uploadBits($name, $bits);
return $this->createFile($name, null, null);
}
示例2: newMediaObject
private function newMediaObject($blog_id, $user, $pwd, $file)
{
if (empty($file['name'])) {
throw new Exception('No file name');
}
if (empty($file['bits'])) {
throw new Exception('No file content');
}
$file_name = $file['name'];
$file_bits = base64_decode($file['bits']);
$this->setUser($user, $pwd);
$this->setBlog();
$media = new dcMedia($this->core);
$dir_name = path::clean(dirname($file_name));
$file_name = basename($file_name);
$dir_name = preg_replace('!^/!', '', $dir_name);
if ($dir_name != '') {
$dir = explode('/', $dir_name);
$cwd = './';
foreach ($dir as $v) {
$v = files::tidyFileName($v);
$cwd .= $v . '/';
$media->makeDir($v);
$media->chdir($cwd);
}
}
$media_id = $media->uploadBits($file_name, $file_bits);
$f = $media->getFile($media_id);
return array('file' => $file_name, 'url' => $f->file_url, 'type' => files::getMimeType($file_name));
}
示例3: name
/**
Creates a file from binary content.
@param name <b>string</b> File name (relative to working directory)
@param bits <b>string</b> Binary file content
*/
public function uploadBits($name, $bits)
{
if (!$this->okt->checkPerm('media') && !$this->okt->checkPerm('media_admin')) {
throw new Exception(__('Permission denied.'));
}
$name = files::tidyFileName($name);
parent::uploadBits($name, $bits);
return $this->createFile($name, null, null);
}