Kcfinder Upload image issue

2019-09-18 09:59发布

问题:

My site is a Codeigniter with kcfinder and ckeditor, and my issue is when I try upload and load an image, this image upload correctly in an autocreated folder /assets/kcfinder/.thumbs/images/, but When I select the image from server, the URL is wrong and I can not see it. How can I set the correct path?

回答1:

I thing that the problem is that you need to add the base url in your image path

base_url() . 'images/' . $img;



回答2:

I have solved the problem. In ../assets/kcfinder/config.php I changed:

'uploadURL' from "upload" to Absolute url and in 'uploadDir' from "" to "upload" and it worked!

Thanks anyway.



回答3:

You can also use below code to set your KcFinder config settings:

<?php
/**
 * KcFinder has a SESSION key name 'KCFINDER'
 * You can use this as setup your dynamic config vales
 * if you set uploadURL and uploadDir via SESSION, KcFinder ignore config.php
 * to get these values and it start using SESSION values
 */
$_SESSION['KCFINDER'] = array(
    'disabled'  => false,
    'uploadURL' => 'http://www.example.com/upload',
    'uploadDir' => 'var/htdocs/www/upload'
);

More: See Link