How to configure elfinder
Added by Simo Abdou 9 months ago
Hi
I've read some tutorials in the documentation, and i've tried these two methodes to configure the filemanager, but it doesn't work :
configuration with javascript
<script type="text/javascript">
$('#my-div').elfinder({
url : 'http://localhost/includes/elfinder/connectors/php/connector.php',
etc.
})
$('#my-div').elfinder({
disableShortcuts:true
})
</script>
configuration with php
I have put this snippet in the top before the doctype declaration :
<?php
include_once 'C:\Program Files\xampp\htdocs\includes\elfinder\connectors\php\elFinder.class.php';
$opts = array(
'fileURL' => true
);
$fm = new elFinder($opts);
$fm->run();
?>
I have gotten this message error : {"error":"Invalid backend configuration"}
So my question how to configure the filemanager ???
Thanks
Replies (6)
RE: How to configure elfinder
-
Added by Troex Nevelin 9 months ago
You haven't set root and URL settings in connector ($opts in your case), these options are required to be set.
Read Install_EN and see Connector_Configuration_EN for more explanation.
RE: How to configure elfinder
-
Added by Simo Abdou 9 months ago
Hi
Thank you for the reply
I have set the required parameters :
<?php
include_once 'E:/installed/xampp/htdocs/mysite/includes/elfinder/connectors/php/elFinder.class.php';
$opts = array(
'root' => "E:/installed/xampp/htdocs/mysite/includes/elfinder/files/",
'URL' => 'http://localhost/mysite/includes/elfinder/files/',
'fileURL' => true
);
$fm = new elFinder($opts);
$fm->run();
?>
But the browser send the following output (in mytest.php) : {"cwd":{"hash":"1d82e96444034ad157960686ea5db7cd","name":"Home","mime":"directory","rel":"Home","size":0,"date":"13 Aug 2011 00:23","read":true,"write":true,"rm":false},"cdc":[{"name":"twacha","hash":"c1aebbbde3cc02886c1b6eaf47652f87","mime":"directory","date":"Today 00:23","size":10808675,"read":true,"write":true,"rm":true}]}
???!!
RE: How to configure elfinder
-
Added by Troex Nevelin 9 months ago
The output looks correct, this data is for elFinder JS client, in your browser you need to open elfinder.html and configure it to point to your connector URL (in your case mytest.php).
RE: How to configure elfinder
-
Added by Simo Abdou 9 months ago
Thank's
But your answer is so far difficult and very concise
Can you give me more exlanation
My page "mytest.php" contains :
<?php
include_once '...elfinder/connectors/php/elFinder.class.php';
$opts = array(
'root' => "...elfinder/files/",
'URL' => 'http://localhost/...elfinder/files/',
'fileURL' => true
);
$fm = new elFinder($opts);
$fm->run();
?>
<html>
<head>
<script src="...jquery-1.6.1.min.js" type="text/javascript"></script>
<script src="...jquery-ui-1.8.13.custom.min.js" type="text/javascript"></script>
<link rel="stylesheet" href="...jquery-ui-1.8.13.custom.css" type="text/css" media="screen">
<script src="...elfinder.min.js " type="text/javascript"></script>
<link rel="stylesheet" href="...elfinder.css" type="text/css" media="screen">
</head>
<body>
<div id="my-div"></div>
</body>
</html>
<script type="text/javascript" charset="utf-8">
fm = new elFinder(document.getElementById('my-div'), {
url : '...elfinder/connectors/php/connector.php',
lang : 'en'
});
</script>
I don't have any idea about the elfinder.html file and where it's located and what it contains ??
RE: How to configure elfinder
-
Added by Simo Abdou 9 months ago
When I remove the first lines related to configuration the elfinder works without problem
<?php
include_once '...elfinder/connectors/php/elFinder.class.php';
$opts = array(
'root' => "...elfinder/files/",
'URL' => 'http://localhost/...elfinder/files/',
'fileURL' => true
);
$fm = new elFinder($opts);
$fm->run();
?>
But when I add these lines I get the output mentioned above
RE: How to configure elfinder
-
Added by Troex Nevelin 9 months ago
Looks like you do not get the idea how elFinder works at all.
What you have done in your mytest.php must be split in two files, one of them can be .html - static without any php this part is elFinder client, download the release and look at the file elfinder.php.html
In this file you will have:
var f = $('#finder').elfinder({
url : 'connectors/php/connector.php',
The only required option is url it must point to the connectors/php/connector.php.
connectors/php/connector.php - this file is elFinder backend (or connector), client part makes AJAX requests to the backend, backend will return JSON, the code you showed us before ({"cwd":{"hash":"1d82e96444034ad157960686ea5db7cd","name":"Home","mime":"d...), client part can understand this output and show files, and directories like on demo.
P.S.: Also I'm not sure that your last code will work at all:
fm = new elFinder(document.getElementById('my-div'), {
url : '...elfinder/connectors/php/connector.php',
lang : 'en'
});
see the elfinder.php.html and wiki docs how to initialize elFinder
(1-6/6)