Kcfinder Upload image issue

2019-09-18 09:58发布

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?

Screenshot

3条回答
ゆ 、 Hurt°
2楼-- · 2019-09-18 10:32

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

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

查看更多
在下西门庆
3楼-- · 2019-09-18 10:34

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.

查看更多
Fickle 薄情
4楼-- · 2019-09-18 10:42

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

查看更多
登录 后发表回答