我是这样称呼编辑的:

new nicEditor({
           buttonList : ['bold','italic','underline','upload'],
           iconsPath:'img/nicedit.png',
           uploadURI : 'http://server.com/integracion/files/nicUpload.php'
}).panelInstance(textareaId);

并且 .php 文件存在(我是 文档, ,我更新了目标路径)

/* I want them here http://server.com/integracion/files/uploads/ so... */   
    define('NICUPLOAD_PATH', './uploads'); // Set the path (relative or absolute) to
                                              // the directory to save image files                  
    define('NICUPLOAD_URI', '/uploads');   // Set the URL (relative or absolute) to
                                              // the directory defined above

但我在上传完成后做出响应(当然还有来自 nicedit 的警报..)

<script>
        try {
            top.nicUploadButton.statusCb({"error":"Invalid Upload ID"});
        } catch(e) { alert(e.message); }
    </script>

我缺少什么?

-编辑

我认为问题可能出在 php 文件中:

$id = $_POST['APC_UPLOAD_PROGRESS'];  /* APC is installed and enabled */
if(empty($id)) {
    $id = $_GET['id'];
}
有帮助吗?

解决方案

最终编辑:

我已经设法制作了这项工作!

这里是一个工作示例:
http://simplestudio.rs/yard/nicedit/

上传的图像将在此处存储:
http://simplestudio.rs/yard/nicedit/images/

和这里是整个代码,只需解压缩它并放在您的服务器上,主要是我需要调整Nicedit.js,因为它有一些问题。
http://simplestudio.rs/yard/nicedit/nicedit.rar

只需使用该文件和通过查看我的示例,使您的代码“,它将工作:)

  • 您还需要安装PHP APC,以便此脚本可以工作:
    http://php.net/manual/en/apc.installation.php

    如果你的任何意思有一些问题,我在这里解决它。

    • 我不会在我的服务器上删除这个例子,以便拥有这个问题的每个人都可以自由下载它...

其他提示

负责图片上传的代码是方法 uploadFile, ,它正在寻找 uploadURI 选项参数。

您将需要修改 onUploaded 事件处理程序来解析您的自定义响应而不是 imgur 的响应(样本)。默认情况下,它至少期望 {"upload": { "links": {"original": "http://..."}, "image": {"width": "123" } }}.

抱歉,我无能为力 表单数据() 使用 PHP 处理服务器端。

欲了解更多信息,您可以尝试 nicEdit 上的演示页面 网站 使用 Firebug 或 WebInspector 来监听网络请求,当然还有源代码。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top