I am using elFinder for manage my FTP files. But I want to open FTP files and folders without giving FTP details. I keep elFinder files on same FTP. Is it possible?
In connector.php:
$opts = array(
// 'debug' => true,
'roots' => array(
array(
'driver' => 'FTP',
'path' => 'here i give path of folder',
'accessControl' => 'access' ,
'tmpPath' => '../files/ftp',// disable and hide dot starting files (OPTIONAL)
'defaults' => array('read' => true, 'write' => true),
'disabled' => array('rename', 'rm' , 'copy' ,'cut','paste')
)
)
);
but when I used this. I get this error:
Invalid backend configuration. Readable volumes not available.
I found the solution for this.To open files we dont need to use ftp option in driver just use localfilesystem and give path of files according to server.
$opts = array(
// 'debug' => true,
' roots' => array(
array(
'driver' => 'localFileSystem',
'path' => 'path of the folder that you want to browse',
'accessControl' => 'access' ,
'defaults' => array('read' => true, 'write' => true),
'disabled' => array('rename', 'rm' , 'copy' ,'cut','paste')
)
)
);
Related
quick question that has been bugging me for days now. I just installed CKfinder and "browsing" works perfect. Except when I want to upload a image or file, it gives me the following error:
Fatal error: Uncaught exception 'ErrorException' with message
'fopen(/home/xxx/app/userfiles/images/sdfdsf.jpg): failed to open
stream: Permission denied' in
/home/xxx/app/webroot/js/packages/finder/core/connector/php/vendor/league/flysystem/src/Adapter/Local.php:142
I used the following settings:
$config['backends'][] = array(
'name' => 'default',
'adapter' => 'local',
'baseUrl' => '/app/userfiles/',
'chmodFiles' => 0777,
'chmodFolders' => 0755,
'filesystemEncoding' => 'UTF-8',
);
$config['backends'][] = array(
'name' => 'ftp',
'adapter' => 'ftp',
'host' => 'xxx',
'username' => 'xxx',
'password' => 'xxx'
);
$config['resourceTypes'] = array(
array(
'name' => 'Files',
'directory' => '/home/websites/www/shared/images/ckfinder/',
'maxSize' => 0,
'allowedExtensions' => 'pdf,doc,zip',
'backend' => 'ftp',
'lazyLoad' => true
),
array(
'name' => 'Images',
'directory' => '/home/websites/www/shared/images/ckfinder/',
'maxSize' => 0,
'allowedExtensions' => 'gif,jpeg,jpg,png',
'backend' => 'ftp',
'lazyLoad' => true
)
);
As said, browsing images that are located in /app/userfiles/ are working perfect. It even returns the name to my input field.
But at the moment I want to upload a image or file I get this error. Anyone who can tell me how to fix this issue?
P.S. The folders have CHMOD 777 so that should be fine. It seems like the error says that it is trying to upload the file, or access it from the wrong directory e.g. my settings are wrong :)
This was just a test but the local resource will be removed, image/file browsing should be from the FTP only, same as the upload directory that is :)
Looks like you tried to define absolute paths for resource types. The path used in directory option of the resource type should be relative to the root of the used backend.
Please have a look at following places in the PHP connector docs:
http://docs.cksource.com/ckfinder3-php/upgrading.html#upgrading_2to3_resource_types
http://docs.cksource.com/ckfinder3-php/howto.html#howto_resource_type_folder
You can use the absolute path to define the backend root, and then use paths relative to the defined root in resource types directory options. For example:
$config['backends'][] = array(
'name' => 'ftp',
'adapter' => 'ftp',
'host' => 'xxx',
'username' => 'xxx',
'password' => 'xxx',
'root' => '/home/websites/www/shared/images/ckfinder/'
);
$config['resourceTypes'] = array(
array(
'name' => 'Images',
//'directory' => '', You can also omit this option - the resource type in this case will be attached to the backend root
'maxSize' => 0,
'allowedExtensions' => 'gif,jpeg,jpg,png',
'backend' => 'ftp',
'lazyLoad' => true
)
);
I'm using zf2 apigility in my web application. With production mode, if config_cache_enabled is true in config/application.config.php, I get this message error when requesting access_token:
The storage configuration for OAuth2 is missing
If I set it to false, I get my access token.
So my problem is to have config_cache_enabled set to true and a successful request for getting the access token in production mode, due to best performance when configuration is cached. How to do that ?
This is my zf-mvc-auth configuration :
'zf-mvc-auth' => array(
'authentication' => array(
'adapters' => array(
'CustomStorage' => array(
'adapter' => 'ZF\\MvcAuth\\Authentication\\OAuth2Adapter',
'storage' => array(
'storage' => 'Application\\Adapter\\OAuth\\CustomPdoAdapter',
'route' => '/oauth',
),
),
),
),
),
This is my oauth2.local.php :
'zf-oauth2' => array(
'db' => array(
'dsn' => 'mysql:dbname=mydatabase;host=localhost',
'username' => 'root',
'password' => '',
),
'allow_implicit' => true,
'access_lifetime' => 3600,
'enforce_state' => true,
'storage' => 'Application\Adapter\OAuth\CustomPdoAdapter',
'storage_settings' => array(
'user_table' => 'users',
),
'options' => array(
'always_issue_new_refresh_token' => true,
),
),
I think it is well configured.
Did you setup your zf-mvc-auth correctly. In the module.config.php you can read that you have to define a storage key. There is also written how you can do this:
To specify the storage instance, you may use one of two approaches:
Specify a "storage" subkey pointing to a named service or an array
of named services to use.
Specify an "adapter" subkey with the value "pdo" or "mongo", and
include additional subkeys for configuring a ZF\OAuth2\Adapter\PdoAdapter
or ZF\OAuth2\Adapter\MongoAdapter, accordingly. See the zf-oauth2
documentation for details.
If you are on production mode and "config_cache_enabled" it's true, you need to delete files on data/cache folder
Is it possible to add a variable into the line in bold?
$opts = array(
// 'debug' => true,
'roots' => array(
array(
'driver' => 'LocalFileSystem', // driver for accessing file system (REQUIRED)
**'path' => '/csgo', // path to files (REQUIRED)**
'URL' => dirname($_SERVER['PHP_SELF']) . '/../files/', // URL to files (REQUIRED)
'accessControl' => 'access' // disable and hide dot starting files (OPTIONAL)
)
)
);
changing it to this did not help
'path' => ".$folder./csgo", // path to files (REQUIRED)
thank you
It should be:
'path' => "$folder/csgo"
A slightly better way:
'path' => "{$folder}/csgo"
This clearly shows the separation of the variable from the string
I am using this configuration for my Elfinder to use with CKEditor.
$opts = array(
// 'debug' => true,
'roots' => array(
array(
'driver' => 'LocalFileSystem', // driver for accessing file system (REQUIRED)
'path' => '../../uploads/', // path to files (REQUIRED)
'URL' => dirname($_SERVER['PHP_SELF']) . '/../../uploads/', // URL to files (REQUIRED)
'accessControl' => 'access' , // disable and hide dot starting files (OPTIONAL)
'uploadAllow' => array('image/jpg', 'image/png'),
'alias' => 'Home',
'mimeDetect' => 'internal',
'imgLib' => 'gd',
),
),
);
However, I am able to upload all the files even PHP files!! I only want images to be uploaded. I am not able to restrict the uploading. Where am I going wrong?
Add:
'uploadOrder'=> array( 'allow', 'deny' )
Without this the default policy is allow if none of them matches.
According to:
https://github.com/Studio-42/elFinder/wiki/Connector-configuration-options#wiki-uploadOrder
I am currently using ElFinder 2.0 .
I want to hide some directory inside the main directory.
How can i do that?
I tried in connector.php file
but not succeeded.
This is my code
$opts = array(
// 'debug' => true,
'roots' => array(
array(
'driver' => 'LocalFileSystem', // driver for accessing file system (REQUIRED)
'path' => '/home/workioscProject/public_html/codensa/catalogo', // path to files (REQUIRED)
'URL' => 'http://76.76.163.155/workioscProject/codensa/catalogo/', // URL to files (REQUIRED)
'accessControl' => 'access' // disable and hide dot starting files (OPTIONAL)
),
),
'attributes' => array(
array(// hide anything else
'pattern' => '!^/exportForms!',
'hidden' => true
)
)
);
// run elFinder
$connector = new elFinderConnector(new elFinder($opts));
$connector->run();
What i do?
Thanks in advance.
$opts = array(
// 'debug' => true,
'roots' => array(
array(
'driver' => 'LocalFileSystem', // driver for accessing file system (REQUIRED)
'path' => '/home/workioscProject/public_html/codensa/catalogo', // path to files (REQUIRED)
'URL' => 'http://76.76.163.155/workioscProject/codensa/catalogo/', // URL to files (REQUIRED)
'accessControl' => 'access' , // disable and hide dot starting files (OPTIONAL)
'attributes' => array(
array(// hide anything else
'pattern' => '!^/exportForms!',
'hidden' => true
)
)
),
)
);