CKeditor
發表於 : 2015-06-02 15:05:28
下載
http://ckeditor.com/
檔案上傳元件
http://ckeditor.com/addon/image
設定檔
config.js
upload.php
ImageBrowse 看圖程式
http://www.ubergallery.net/
http://ckeditor.com/
檔案上傳元件
http://ckeditor.com/addon/image
設定檔
config.js
代碼: 選擇全部
/**
* @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved.
* For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.editorConfig = function( config ) {
// Define changes to default configuration here. For example:
// config.language = 'fr';
// config.uiColor = '#AADC6E';
//config.filebrowserImageUploadUrl = 'php/upload.php';
//config.filebrowserBrowseUrl = "../CKeditor/attachment_files";
//config.filebrowserUploadUrl = "../CKeditor/attachment_files";
//config.filebrowserFlashBrowseUrl = "../CKeditor/attachment_files";
//config.filebrowserFlashUploadUrl = "../CKeditor/attachment_files";
config.filebrowserImageBrowseUrl = "../../upload/ckeditor/";
config.filebrowserImageUploadUrl = "../../upload/ckeditor/upload.php";
};
代碼: 選擇全部
<?php
/*
print_R($_FILES);
exit;
*/
//$url = '../../upload/ckeditor/'.time()."_".$_FILES['upload']['name'];
$url = '../../upload/ckeditor/'.$_FILES['upload']['name'];
//extensive suitability check before doing anything with the file…
if (($_FILES['upload'] == "none") OR (empty($_FILES['upload']['name'])) ) {
$message = "No file uploaded.";
}
else
if ($_FILES['upload']["size"] == 0) {
$message = "The file is of zero length.";
}
else
if (($_FILES['upload']["type"] != "image/pjpeg") AND ($_FILES['upload']["type"] != "image/jpeg") AND ($_FILES['upload']["type"] != "image/png")) {
$message = "The image must be in either JPG or PNG format. Please upload a JPG or PNG instead.";
}
else
if (!is_uploaded_file($_FILES['upload']["tmp_name"])) {
$message = "You may be attempting to hack our server. We're on to you; expect a knock on the door sometime soon.";
}
else {
$message = "";
$move = @ move_uploaded_file($_FILES['upload']['tmp_name'], $url);
if (!$move) {
$message = "Error moving uploaded file. Check the script is granted Read / Write / Modify permissions.";
}
//$url = "../" . $url;
}
$funcNum = $_GET['CKEditorFuncNum'] ;
echo "<script type = 'text/javascript'>window.parent.CKEDITOR.tools.callFunction($funcNum, '$url', '$message');</script>";
?>
http://www.ubergallery.net/