This extension allows use elFinder file manager in your Yii application. Possible usage:
Tested with Yii 1.1.10, but should work with previous versions too
// controller to host connector action class ElfinderController extends CController { public function actions() { return array( 'connector' => array( 'class' => 'ext.elFinder.ElFinderConnectorAction', 'settings' => array( 'root' => Yii::getPathOfAlias('webroot') . '/uploads/', 'URL' => Yii::app()->baseUrl . '/uploads/', 'rootAlias' => 'Home', 'mimeDetect' => 'none' ) ), ); } } //server file input $this->widget('ext.elFinder.ServerFileInput', array( 'model' => $model, 'attribute' => 'serverFile', 'connectorRoute' => 'admin/elfinder/connector', ) ); // ElFinder widget $this->widget('ext.elFinder.ElFinderWidget', array( 'connectorRoute' => 'admin/elfinder/connector', ) );
Total 18 comments
Not yet, I think before doing this we need to wait at least for the alpha version.
Hi, are you already working on a yii2 version of this extension?
Would be cool to know, as I would love to use this extension in my new "internal" intranet site...
there are no those buttons. Check it out. I was donwload last version of ext. and i has no change any files.
There is settings property where you can override default widget settings, you can read more about these options here: https://github.com/Studio-42/elFinder/wiki/elFinder-1.x#client-configuration
But as I remember, by default, there is all avaliable buttons on toolbar, so - in order to add these buttons to toolbar probably you will need to modify elFinder scripts.
How can i add zip/unzip button to panel?
Everything worked great locally, but on upload to the server (PHP Version 5.2.17, Linux) I had a connector problem.
On inspecting the response I got the following error:
I had to edit the line to: (adding the &&count($this->_options['archivers'])>0)
which solved it. (I know this is a elFinder core problem, but I wanted you guys to have the solution at hand if you ran into the same problem :)
Added your changes to extension
Not sure if there was a supported way to do this, but I wanted several fields using elFinder on the same page. Unfortunately, only the last widget's connector path was used, which messes things up if your multiple fields require different locations on your server (and the other settings that you can set in the connector). So...
I've edited the ServerFileInput.php to change how the javascript is rendered on the page. In this file find the run() method and swap out the following code: (starts at line 80)
For noobs (including myself) who didn't know you can include multiple settings in the single connector controller e.g.
About where to place meta-tags
Place that code in head tag of html page(maybe it is in your layout)
About elfinder 2.x
As I seen elFinder in general was rewrited in 2.x branch, so there are many new features and new interface. I have made it integration as separate widget, and - it works ok.
Also I have started work on integration with TinyMCE, and there is one problem - now elFinder has no option to open in modal dialogue. So we need to open it in iframe(as described in elFinder wiki about integration with tinyMCE) or write code to properly open it in modal dialogue. About opening it in iframe - at my mind it is too ugly(i have tried and do not like this at all), most ugliest thing in it - is modal dialogues opened from elFinder within iframe. About second one - in my current realization it also looks bad.
So, because I have no need in new features right now, I decided do not continue developing extension for elFinder 2.x until official release. Or until i have more free time for this.
Anyway I have published it here: elFinder 2.x on bitbucket . So you can try it.
Sorry for my ignorance, where exactly i need introduce this code? "page header", i have a "actionAdmin" on controller an view "admin" where i show elFinder.
Another question, for what you didnt introduce new version of elFinder?, is on RC1. Is easy to change to version 2?
In elFinder source code I have found support for "Rails csrf meta tag". So you can add Yii CSRF token to elFinder using the same meta tags:
Thanks for this great extension.
When i have active CSRF, i cant upload files. some one knows how resolve this problem?
Thanks.
No, because file selected in this widget already on server, widget is only to pick file url on server. You can save this url for use in your app. Also according to your connector cofiguration you can get file path on server and for example copy it somewhere.
As i understood this widget insert text field in form. Can i change it to file field?
This is because $model->icon is not file field - it is text field with file url on server.
Ok i have configure widget and it's work very well, but i can't take file by CUploadedFile::getInstance, when i write in controller: $model->icon=CUploadedFile::getInstance($model,'icon'); - i get "null"
this is widget: $this->widget('ext.elFinder.ServerFileInput', array( 'model' => $model, 'attribute' => 'icon', 'connectorRoute' => '/elfinder/connector', ) );
Check connectorRoute passed to widget: is “connector” action properly configured? “uploads” directory exists and is writable for webserver process? (your can read more about connector options in elFinder 1.x wiki).
Also, if something wrong in backend configuration options(connectorRoute to which is passed), you can see server response in network tab with chrome developer tools(or in something similar, with tools, what you are using) - it can be very helpfull to determine problem which you has.
I installed your extension, but when I click "choose file" I get the message: Unable to connect to backend!. What I missed?
Leave a comment
Please login to leave your comment.