在CKFinder里,文件上传路径主要配置ckfinder/config.php中的$baseUrl变量
/*
$baseUrl : the base path used to build the final URL for the resources handled
in CKFinder. If empty, the default value (/userfiles/) is used.
Examples:
$baseUrl = 'http://example.com/ckfinder/files/';
$baseUrl = '/userfiles/';ATTENTION: The trailing slash is required.
*/
$baseUrl = '/ckfinder/userfiles/';
上边这是它的默认配置,该文件里已说明,要么它是以http开头的url地址,要么就是以"/"开头的地址,"/"代表的是DocumentRoot的位置,如果以"/"开头写死了,当程序迁移的时候又得改这路径,怎么办?
今天摸索了一下午,终于找到一个办法,如果我的项目是MyApp,我的ckfinder就放在MyApp下边,我想把文件上传到MyApp/uploads/userfiles/下,这时我就可以这样做:
$phpSelf = $_SERVER["PHP_SELF"];
$baseUrl = substr($phpSelf, 0, strpos($phpSelf, 'ckfinder')).'uploads/userfiles/';
哈哈,真是高兴~