2012-06-11 157 views
1

我試圖將CKFinder與CKEditor集成到一個CodeIgniter應用程序中,並且它看起來像使用它時一切正常,但是當我轉到該文件夾​​時(默認/ ckfinder/userfiles仍然是在config.php文件中設置)那裏沒有文件。奇怪的是,如果我點擊CKFinder對話框中的「瀏覽服務器」按鈕,我確實看到了我已經「上傳」的圖像,但我不知道它們在物理上的位置,因爲它們並不在指定文件夾。CKFinder沒有上傳圖片

這裏是我的設置:

$(document).ready(function() { 

    var config = { 

     toolbar:[ 
      ['Bold', 'Italic', '-', 'NumberedList', 'BulletedList', '-', 'Undo', 'Redo', '-', 'SelectAll', 'Format'], 
      ['UIColor'], 
      ['Image', '-', 'Link', 'Source'] 
     ], 

     filebrowserBrowseUrl:base_url + '/ckfinder/ckfinder.html', 
     filebrowserImageBrowseUrl:base_url + '/ckfinder/ckfinder.html?Type=Images', 
     filebrowserFlashBrowseUrl:base_url + '/ckfinder/ckfinder.html?Type=Flash', 
     filebrowserUploadUrl:base_url + '/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files', 
     filebrowserImageUploadUrl:base_url + '/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Images', 
     filebrowserFlashUploadUrl:base_url + '/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Flash' 



    }; 
    config.format_tags = 'p;h2;h3;div' 
    $('textarea.editor').ckeditor(config); 


}); 

,一切都很便利,只要取景器開放,讓你選擇一個文件等工作,但這些文件只是不顯示文件夾中了。

任何想法我做錯了什麼?

回答

2

我沒有在你的代碼中看到上傳功能

我貼我的代碼,it's工作的罰款。

對於名稱= '說明' 和id = '說明'

在我看來,一個textarea:

<script type='text/javascript'> 

$(document).ready(function(){ 

    CKEDITOR.replace('description', {filebrowserUploadUrl : "/admin/ckeditor/"}); 

    $('#submit').click(function() { 

     CKEDITOR.instances.description.updateElement(); 

     return true; 

    }); 

}); 

</script> 

在我的管理控制,我已經上傳功能

public function ckeditor() 
{ 
    $url = FCPATH.'public/uploads/ckeditor/'.time()."_".$_FILES['upload']['name']; 

    $url_aux = substr($url, strlen(FCPATH) - 1); 

    if (($_FILES['upload'] == "none") OR (empty($_FILES['upload']['name']))) 
    { 
     $message = "No file uploaded."; 
    } 
    else if(file_exists(FCPATH.'public/uploads/ckeditor/'.$_FILES['upload']['name'])) 
    { 
     $message = "File already exists"; 
    } 
    else if ($_FILES['upload']["size"] == 0) 
    { 
     $message = "The file is of zero length."; 
    } 
    else if (($_FILES['upload']["type"] != "image/pjpeg") AND ($_FILES['upload']["type"] != "image/jpeg") AND ($_FILES['upload']["type"] != "image/png")) 
    { 
     $message = "The image must be in either JPG or PNG format. Please upload a JPG or PNG instead."; 
    } 
    else if (!is_uploaded_file($_FILES['upload']["tmp_name"])) 
    { 
     $message = "You may be attempting to hack our server. We're on to you; expect a knock on the door sometime soon."; 
    } 
    else 
    { 
     $message = "Image uploaded correctly"; 

     move_uploaded_file($_FILES['upload']['tmp_name'], $url); 
    } 


    $funcNum = $_GET['CKEditorFuncNum'] ; 
    $url = $url_aux; 
    echo "<script type='text/javascript'>window.parent.CKEDITOR.tools.callFunction($funcNum, '$url', '$message');</script>"; 

}