[轉]HOW TO MAKE UPLOAD IMAGE IN CKEDITOR.
http://www.dukaweb.net/2014/01/how-to-make-upload-image-in-ckeditor.html
In script tag, which we call CKEditor put one more code:
CKEDITOR.replace( ‘editor1’, {
filebrowserUploadUrl: “upload/upload.php”
} );
In upload.php
if (file_exists(“img/"; . $_FILES[“upload”][“name”]))
{
echo $_FILES[“upload”][“name”] . " already exists please choose another image.";
}
else
{
move_uploaded_file($_FILES[“upload”][“tmp_name”],
“img/” . $_FILES[“upload”][“name”]);
echo “Stored in: " . “img/” . $_FILES[“upload”][“name”];
}
If you get an error “image source url is missing“, that means the url of the image doesn’t pass to the image info tab, you can fix this error by adding the php code to pass the image url.
In upload.php file
Add the following code in the else function
// Required: anonymous function reference number as explained above.
$funcNum = $_GET[‘CKEditorFuncNum’] ;
// Optional: instance name (might be used to load a specific configuration file or anything else).
$CKEditor = $_GET[‘CKEditor’] ;
// Optional: might be used to provide localized messages.
$langCode = $_GET[‘langCode’] ;
// Check the $_FILES array and save the file. Assign the correct path to a variable ($url).
$url = “img/” . $_FILES[“upload”][“name”];
// Usually you will only assign something here if the file could not be uploaded.
$message = ‘';
echo “ window.parent.CKEDITOR.tools.callFunction($funcNum, ‘$url’, ‘$message’);";
http://www.paulfp.net/blog/2010/10/how-to-add-and-upload-an-image-using-ckeditor/
-———
http://bittyferrari.blogspot.tw/2015/03/ckeditor-image-upload.html
做法就是用個jquery的ajax檔案upload功能
我是包了這個 jquery-fileupload.min.js
function addImg(v) {
CKEDITOR.instances.content.insertHtml('');
}
==========
Integration blueimp fileupload in ckeditor
http://stackoverflow.com/questions/14013418/integration-blueimp-fileupload-in-ckeditor
https://github.com/blueimp/jQuery-File-Upload
jquery file upload 后台收到的文件名中文乱码, filename中文乱码
http://blog.csdn.net/zhouyingge1104/article/details/38322403