在CKEditor中,无法上传图像。?

时间:2013-01-03 08:11:25

标签: javascript ckeditor

我正在使用CKEditor(3.62),在从图像按钮上传图像时,图像未在CKEditor中加载。如何解决这个问题。?

2 个答案:

答案 0 :(得分:1)

我在ckeditor中集成了ckfinder。而我上传图像的脚本错误,即在ckfinder.html。我不知道如何在ckeditor中设置ckfinder。如何解决问题。

@philipp here is the script error page.

答案 1 :(得分:1)

提供路径可能存在一些问题。 尝试执行以下步骤。

1.下载CKEditor和CKFinder。可在http://dwij.co.in/ckeditor-ckfinder-integration-using-php/上提供集成代码 2.将两者的解压缩代码放在xampp内的一个文件夹中,如下所示。 3.创建索引文件(index.html),其中包含编辑器,如下所示。

    <html>
    <head>
    <script type="text/javascript" src="ckeditor/ckeditor.js"></script>
    <script type="text/javascript" src="ckfinder/ckfinder.js"></script>
    </head>
    <body>
        <h1>CKEditor CKFinder Integration using PHP</h1>
        <textarea id="editor1" name="editor1" rows="10" cols="80"></textarea>
    <script type="text/javascript">
    var editor = CKEDITOR.replace( 'editor1', {
        filebrowserBrowseUrl : 'ckfinder/ckfinder.html',
        filebrowserImageBrowseUrl : 'ckfinder/ckfinder.html?type=Images',
        filebrowserFlashBrowseUrl : 'ckfinder/ckfinder.html?type=Flash',
        filebrowserUploadUrl : 'ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files',
        filebrowserImageUploadUrl : 'ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Images',
        filebrowserFlashUploadUrl : 'ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Flash'
    });
    CKFinder.setupCKEditor( editor, '../' );
    </script>
    </body>
    </html>

所以你的文件夹结构将是这样的:

htdocs
|_integrated
    |_ckeditor
    |   |_config.js
    |   |_...
    |_ckfinder
    |   |_config.php
    |   |_...
    |_uploads
    |_index.html
  1. 现在在ckfinder&amp;中打开文件config.php进行以下更改:

    function CheckAuthentication() {
        // WARNING : DO NOT simply return "true". By doing so, you are allowing
        // "anyone" to upload and list the files in your server. You must implement
        // some kind of session validation here. Even something very simple as...
        // return isset($_SESSION['IsAuthorized']) && $_SESSION['IsAuthorized'];
        return true; // not good option though; go for sessions
    }
    $baseUrl = 'http://localhost/integrated/uploads/';
    $enabled = true;
    $config['SecureImageUploads'] = false;
    $config['ChmodFolders'] = 0777 ;
    
  2. 现在打开网址http://localhost/integrated/并尝试上传图片。