1. First, modify the config.js configuration file in the CKEditor directory
CKEDITOR.editorConfig = function( config )
{
var siteUrl = 'http://'+document.domain+'/';
};
2. upload.php file, handles the upload
<?php
$errRequestFunction = "Error as a function call requests"; // Error: invalid function call request
$errRequestFile = "Request the wrong file called"; // Error: invalid file call request
$errFileType = "The wrong file type"; // Error: incorrect file type!
$errUpfile = "File upload failed, please check the upload directory and directory read and write permissions set"; // Error: file upload failed, please check the upload directory settings and read/write permissions
$uploadExceed = "The uploaded file can not exceed"; // Uploaded file cannot exceed
$config = array ();
$config ['type'] = array ("flash", "img" ); // Allowed upload type values
$config ['img'] = array ("jpg", "bmp", "gif" ); // Allowed image file extensions
$config ['flash'] = array ("flv", "swf" ); // Allowed flash file extensions
$config ['flash_size'] = 2000; // Maximum flash upload size, unit: KB
$config ['img_size'] = 5000; // Maximum image upload size, unit: KB
$config ['message'] = "Upload Success!"; // Message displayed on successful upload; if empty, no message is shown after upload success
$config ['name'] = mktime (); // Naming rule for uploaded files, using Unix timestamp here
$config ['flash_dir'] = $_SERVER['DOCUMENT_ROOT']."/upload"; // Upload directory for flash files (absolute path), convenient for placing upload.php anywhere on the site; no trailing "/". Uploaded files will be placed in the upload folder under the site root
$config ['img_dir'] = $_SERVER['DOCUMENT_ROOT']."/upload"; // Upload directory for image files (absolute path), convenient for placing upload.php anywhere on the site; no trailing "/". Uploaded files will be placed in the upload folder under the site root
$config ['site_url'] = "http://www.xxx.com"; // Website URL, related to the URL of uploaded images; no trailing "/"; can be left empty
// Create folders if they do not exist
isDirAll($config ['flash_dir']);
isDirAll($config ['img_dir']);
// File upload
uploadfile ();
function uploadfile() {
}
// Output JS callback
function mkhtml($fn, $fileurl, $message) {
}
function isDirAll($dir) {
}
function isMkDir($dir = "") {
}
?>