1. 解壓縮,將 elfinder-1.x 目錄改名為 elfinder,並複製到 htdocs 下。
2. 設定FCKEditor
<textarea name='content' cols=30 rows=5 id='editor'>請輸入內容</textarea>
<script type='text/javascript'>
CKEDITOR.replace('editor',{skin : 'v2' , filebrowserBrowseUrl : 'elfinder.html'});
</script>
3. 建立上傳目錄,如 htdocs/files
4. 製作 elfinder 專頁 elfinder.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title></title>
</head>
<body>
<div id='finder'></div>
<!-- jQuery and jQuery UI -->
<script src="elfinder/js/jquery-1.6.1.min.js" type="text/javascript" charset="utf-8"></script>
<script src="elfinder/js/jquery-ui-1.8.13.custom.min.js" type="text/javascript" charset="utf-8"></script>
<link rel="stylesheet" href="elfinder/css/smoothness/jquery-ui-1.8.13.custom.css" type="text/css" media="screen" charset="utf-8">
<link rel="stylesheet" href="elfinder/css/elfinder.css" type="text/css" media="screen" title="no title" charset="utf-8">
<script src="elfinder/js/elfinder.min.js" type="text/javascript" charset="utf-8"></script>
<script src="elfinder/js/i18n/elfinder.zh_TW.js" type="text/javascript" charset="utf-8"></script>
<script type='text/javascript'>
$().ready(function() {
var funcNum = window.location.search.replace(/^.*CKEditorFuncNum=(\d+).*$/, "$1");
var langCode = window.location.search.replace(/^.*langCode=([a-z]{2}).*$/, "$1");
$('#finder').elfinder({
url : 'elfinder/connectors/php/connector.php',
lang : langCode,
editorCallback : function(url) {
window.opener.CKEDITOR.tools.callFunction(funcNum, url);
window.close();
}
})
})
</script>
</body>
</html>
5. 修改 elfinder/connectors/php/connector.php,設定 31、32 行,設定為正確位置,如:
'root' => '../../../files', // path to root directory
'URL' => 'http://localhost/files/', // root directory URL
將 42 行的 mimeDetect 註解取消,如此才能看得到縮圖。