【发布时间】:2017-07-30 15:13:17
【问题描述】:
我在 CKeditor 上配置 uploadimage 插件以允许拖放图像时遇到一些困难。
我包含了两个插件uploadimage和它的依赖uploadwidget。
这是上传的php文件:
$basePath = "/var/www/html/images/articles/";
$baseUrl = "/var/www/html/images/articles/";
$funcNum = $_REQUEST['CKEditorFuncNum'] ;
if (isset($_FILES['upload'])) {
$name = $_FILES['upload']['name'];
move_uploaded_file($_FILES["upload"]["tmp_name"], $basePath . $name);
$url = $baseUrl . $name ;
$message = 'new file uploaded';
}
else
{
$message = 'No file has been sent';
}
echo "<script type='text/javascript'> window.parent.CKEDITOR.tools.callFunction($funcNum, '$url', '$message')</script>";
问题在于 CKEditorFuncNum,因为我没有从表单中收到任何内容。
文件已正确上传到 $basePath,但函数 window.parent.CKEDITOR.tools.callFunction 由于缺少 funcNum 而失败
ckeditor.js:3 [CKEDITOR] Error code: filetools-response-error.
Object {responseText: "<br />↵<b>Notice</b>: Undefined index: CKEditorFu…icles/371c63d.jpg', 'new file uploaded')</script>"}
你们知道为什么我没有从 $_REQUEST['CKEditorFuncNum'] 得到任何东西吗?
谢谢
【问题讨论】:
-
因为错误说看起来您没有索引 CKEditorFuncNum,请尝试使用
var_dump($_REQUEST);检查您的请求 -
是的,没错!我没有收到 CKeditorFuncNum 索引,但我不明白为什么它不是来自编辑器