Php 如何为ckeditor+;自定义上载文件夹;kcfinder在Laravel中使用?
我正在尝试使用kcfinder作为Ckeditor的插件上传照片。 配置kcfinder时,我使用以下配置:Php 如何为ckeditor+;自定义上载文件夹;kcfinder在Laravel中使用?,php,laravel,ckeditor,laravel-4,kcfinder,Php,Laravel,Ckeditor,Laravel 4,Kcfinder,我正在尝试使用kcfinder作为Ckeditor的插件上传照片。 配置kcfinder时,我使用以下配置: CKEDITOR.editorConfig = function(config) { config.filebrowserBrowseUrl = '../../../../assets/kcfinder/browse.php?type=files'; config.filebrowserImageBrowseUrl = 'assets/kcfinder/browse.php?
CKEDITOR.editorConfig = function(config) {
config.filebrowserBrowseUrl = '../../../../assets/kcfinder/browse.php?type=files';
config.filebrowserImageBrowseUrl = 'assets/kcfinder/browse.php?type=images';
config.filebrowserFlashBrowseUrl = 'assets/kcfinder/browse.php?type=flash';
config.filebrowserUploadUrl = '../../../../assets/kcfinder/upload.php?type=files';
config.filebrowserImageUploadUrl = '../../../../assets/kcfinder/upload.php?type=images';
config.filebrowserFlashUploadUrl = 'assets/kcfinder/upload.php?type=flash';
};
上载已打开,并且我的kcfinder config.php具有:
'uploadURL' => "/uploads/img/posts/".$post->id ,
'uploadDir' => "/home/ytsejam/public_html/remake/public/uploads/img/posts/".$post->id,
'dirPerms' => 0755,
'filePerms' => 0644,
'access' => array(
'files' => array(
'upload' => true,
'delete' => true,
'copy' => true,
'move' => true,
'rename' => true
),
'dirs' => array(
'create' => true,
'delete' => true,
'rename' => true
)
),
kcfinder有一个uploader.php
//上传文件夹初始化
// FULL URLid
if (preg_match('/^([a-z]+)\:\/\/([^\/^\:]+)(\:(\d+))?\/(.+)\/?$/',
$this->config['uploadURL'], $patt)
) {
list($unused, $protocol, $domain, $unused, $port, $path) = $patt;
$path = path::normalize($path);
$this->config['uploadURL'] = "$protocol://$domain" . (strlen($port) ? ":$port" : "") . "/$path";
$this->config['uploadDir'] = strlen($this->config['uploadDir'])
? path::normalize($this->config['uploadDir'])
: path::url2fullPath("/$path");
$this->typeDir = "{$this->config['uploadDir']}/{$this->type}";
$this->typeURL = "{$this->config['uploadURL']}/{$this->type}";
// SITE ROOT
} elseif ($this->config['uploadURL'] == "/") {
$this->config['uploadDir'] = strlen($this->config['uploadDir'])
? path::normalize($this->config['uploadDir'])
: path::normalize($_SERVER['DOCUMENT_ROOT']);
$this->typeDir = "{$this->config['uploadDir']}/{$this->type}";
$this->typeURL = "/{$this->type}";
// ABSOLUTE & RELATIVE
} else {
$this->config['uploadURL'] = (substr($this->config['uploadURL'], 0, 1) === "/")
? path::normalize($this->config['uploadURL'])
: path::rel2abs_url($this->config['uploadURL']);
$this->config['uploadDir'] = strlen($this->config['uploadDir'])
? path::normalize($this->config['uploadDir'])
: path::url2fullPath($this->config['uploadURL']);
$this->typeDir = "{$this->config['uploadDir']}/{$this->type}";
$this->typeURL = "{$this->config['uploadURL']}/{$this->type}";
}
if (!is_dir($this->config['uploadDir']))
@mkdir($this->config['uploadDir'], $this->config['dirPerms']);
我如何更正我的上传文件夹添加帖子id号,例如:
“/public/uploads/img/posts/$post->id”
感谢您的回答只需将js文件扔到公共路径中并包含在标记中即可。然后,只需简单的js调用即可激活编辑器:
<textarea name="content" id="content"></textarea>
<script type="text/javascript" src="<?= url('js/admin/ckeditor/ckeditor.js') ?>"></script>
<script>CKEDITOR.replace('content');</script>
你好,我需要你的帮助来理解,你是如何设置路线的?