simialbi/yii2-elfinder

Unable to set URL under connectionSets

Closed this issue · 3 comments

 'connectionSets' => [
                'default' => [ // like elfinder roots
                    [
                        'class' => 'simialbi\yii2\elfinder\ElFinderConfigurationLocalFileSystem',
                        'path'  => '@webroot/uploads',
                        'URL'   => '@web/file/files'
                    ]
                ]
            ],

This is how I have defined URL 'URL' => '@web/file/files' where file is my controller and files is my action .
Could you please let me know how exactly this URL show be passed in yii2 basic template .

127.0.0.1:8080/project/elfinder/proxy/index?baseUrl=QHdlYi9maWxlL2ZpbGVz&path=/NewFolder/file_example_PNG_500kB.png&_t=1587811929

The Module automatically rewrites your URL by one used via ProxyController here:
https://github.com/simialbi/yii2-elfinder/blob/master/Module.php#L129
This guarantees always working URLs on all systems with no encoding problems or strange filenames behaviors. If I understand correctly: what you'd like to do is use without this proxy controller?

Thanks for the response .Url manager helped me in this scenario . Really appreciate your work .
This is how I resolved it .

    'urlManager' => [
  'controller/action/<file:.*>' => 'controller/action',
]
public function actionYourActionName($file)
    {
        $image_path = YOUR_UPLOAD_PATH . basename($file);
        if (file_exists($image_path)) {
            return \yii::$app->response->sendFile($image_path, $file, [
                'inline' => true //OPTIONAL
            ]);
        } 
         return "What exception you want to throw";
    }

I'm glad to hear you could solve it yourself. Thx 4 the post of your solution