ckeditor的图片上传
开始
下载ckeditor,ckfinder,将这两个文件放在更目录下边的include文件夹下面
在使用ckeditor的html
ckfinder.php的修改
63行:
$baseUrl改为:
$phpSelf = $_SERVER["PHP_SELF"];
$basePath = substr($phpSelf, 0, strpos($phpSelf, 'cekditor')).'/application/news/';//我的存储路径
$baseUrl =$basePath;
85行:
$baseUrl:
$baseUrl原来的删除:
改为:
$baseDir = substr($_SERVER['SCRIPT_FILENAME'], 0,strpos($_SERVER['SCRIPT_FILENAME'], 'ckeditor')).'/application/news/' ;//项目路径
function CheckAuthentication(){
return true;//建议加一个判断,原来是return false
}
<script type='type/javascript' src='include/ckeditor/ckeditor.js'> </script>
<script type='type/javascript' src='include/ckfinder/ckfinder.js'> </script>
<script type='type/javascript'>
N_Text=CKEDITOR.replace('N_Text',{
toolbar : 'Basic',
uiColor : '#9AB8F3',
filebrowserBrowseUrl : '<!--{$approot}-->ckeditor/ckfinder/ckfinder.html',//<!--{$approot}-->的路径是从php页面许可过来的,从项目路径出发
filebrowserImageBrowseUrl : '<!--{$approot}-->ckeditor/ckfinder/ckfinder.html?Type=Images',
filebrowserFlashBrowseUrl : '<!--{$approot}-->ckeditor/ckfinder/ckfinder.html?Type=Flash',
filebrowserUploadUrl : '<!--{$approot}-->ckeditor/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files',
filebrowserImageUploadUrl : '<!--{$approot}-->ckeditor/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Images',
filebrowserFlashUploadUrl : '<!--{$approot}-->ckeditor/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Flash'
});
</script>
加粗部分的路径必须正确,否则上传不显示。