zxbodya / yii2-elfinder

Extension to use elFinder 1.x file manager in Yii2 application
10 stars 11 forks source link

Unable to connect backend #1

Open sagarguhe opened 9 years ago

sagarguhe commented 9 years ago

Hi, I am using yii2 basic template, I am getting "Unable to connect backend" error when I try to upload images... I am having code like this in my files:

_form.php


  $form->field($model, 'body')->widget(
        TinyMce::className(),
        [
            'fileManager' => [
                'class' => TinyMceElFinder::className(),
                'connectorRoute' => 'el-finder/connector',
            ],
        ]
    ); 

ArticleController.php


public function actions()
    {
        $actions = parent::actions();

        $actions['tinyMceCompressor'] = [
            'class' => TinyMceCompressorAction::className(),
        ];

        $actions['connector'] = array(
            'class' => ConnectorAction::className(),
            'settings' => array(
                'root' => Yii::getAlias('@webroot') . '/uploads/',
                'URL' => Yii::getAlias('@web') . '/uploads/',
                'rootAlias' => 'Home',
                'mimeDetect' => 'none'
            )
        );

        return $actions;
    }

What should be the issue, please tell me where I am getting wrong.

zxbodya commented 9 years ago

'connectorRoute' => 'el-finder/connector',

You are trying to use connector action from ElFinderController, but it is defined in ArticleController... So, just replace it with 'article/connector'

sagarguhe commented 9 years ago

Hey Thanks for quick reply, It solved the above problem I think but now new error is coming which is Invali backend configuration...

P.S: for information I have renamed "web" directory to "admin", so do I need to create an alias for it?

myomyintaung512 commented 8 years ago

Juz create a "uploads" folder in your web root directory may be @web\uploads

mydesign commented 8 years ago
namespace backend\controllers;         
use Yii;       
use yii\web\Controller;         
use zxbodya\yii2\elfinder\ConnectorAction; 

class ElFinderController extends Controller         
{         
    public function actions()         
    {         
        return [         
            'connector' => array(         
                'class' => ConnectorAction::className(),         
                'settings' => array(         
                    'root' => Yii::getAlias('@frontend') . '/web/uploads/',                    
                    'URL' => '/uploads/',         
                    'rootAlias' => 'Home',         
                    'mimeDetect' => 'none'         
                )                    
            ),         
        ];                    
    }         
}
?>