Closed ghost closed 4 years ago
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
This is how I have defined URL
'URL' => '@web/file/files'
wherefile
is my controller andfiles
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