2016-01-25 23 views
5

在這裏,我使用ckeditor插入記錄並使用ckeditor上傳圖像。 當我要在添加時插入圖像時,我可以使用kcfinder上傳圖像。 當時我正在聯繫合適的插入圖像一樣,(當我得到的環節http://localhost/project/ABC/policies/add在使用ckeditor編輯時獲取404錯誤

http://localhost/svn_project/PMS/resource/kcfinder/browse.php?opener=ckeditor&type=images&CKEditor=description&CKEditorFuncNum=1&langCode=en 

但是,當我想編輯記錄上傳一張圖片,它顯示了撥錯網址一樣,(當我得到的環節http://localhost/project/ABC/policies/edit/2

http://localhost/svn_project/PMS/hr_policies/resource/kcfinder/browse.php?opener=ckeditor&type=images&CKEditor=description&CKEditorFuncNum=1&langCode=en 

在CKEditor的的config.js,

CKEDITOR.editorConfig = function(config) { 
    // Define changes to default configuration here. 
    // For complete reference see: 
    // http://docs.ckeditor.com/#!/api/CKEDITOR.config 

    config.filebrowserBrowseUrl = '../resource/kcfinder/browse.php?opener=ckeditor&type=files'; 
    config.filebrowserImageBrowseUrl = '../resource/kcfinder/browse.php?opener=ckeditor&type=images'; 
    config.filebrowserFlashBrowseUrl = '../resource/kcfinder/browse.php?opener=ckeditor&type=flash'; 
    config.filebrowserUploadUrl = '../resource/kcfinder/upload.php?opener=ckeditor&type=files'; 
    config.filebrowserImageUploadUrl = '../resource/kcfinder/upload.php?opener=ckeditor&type=images'; 
    config.filebrowserFlashUploadUrl = '../resource/kcfinder/upload.php?opener=ckeditor&type=flash'; 
    config.removeDialogTabs = 'link:advanced'; 
}; 

所以,我應該怎麼做,在編輯的時候,我可以上傳圖片。?

回答

3

我認爲這可能與您在配置中指定URL的方式有關。

你...

config.filebrowserBrowseUrl = '../resource/kcfinder/browse.php?opener=ckeditor&type=files'; 

相反,嘗試從您的網站的根目錄中列出它。假設你的「資源」文件夾是在您的網站的根目錄,這將是...

config.filebrowserBrowseUrl = '/resource/kcfinder/browse.php?opener=ckeditor&type=files'; 

讓您的每個配置的網址(config.filebrowserImageBrowseUrl,config.filebrowserFlashBrowseUrl等的這種變化? )

祝你好運! Tom

0

可能是config.php中路徑的錯誤。

相對於文檔根目錄的路徑(該部分位於域名之後)。

$ Config ['UserFilesPath'] ='/ files /'; 絕對服務器路徑到上面相同的目錄 $ Config ['UserFilesAbsolutePath'] =「/home/login/public_html/example.com/files/」;請注意: $ Config ['UserFilesPath'] ='http://example.com/files/'; 是好的。

但: $ Config ['UserFilesAbsolutePath'] =「http://example.com/files/」;是錯誤的。