nao-pon / elFinder

2.1_n and 2.0_n is deprecated please use Studio-42/elFinder
https://github.com/Studio-42/elFinder
Other
16 stars 7 forks source link

Not been able to make the Dropbox driver to work #10

Open digu087 opened 10 years ago

digu087 commented 10 years ago

Hi I am trying to use your Dropbox driver but I am not been able to set it up poroperly. Here are my connector options $opts = array( 'debug' => true, 'bind' => array( // '*' => 'logger', 'mkdir mkfile rename duplicate upload rm paste netmount' => 'logger' ), 'netVolumesSessionKey' => 'netVolumes', 'roots' => array( array( 'driver' => 'Dropbox', // driver for accessing file system (REQUIRED) 'consumerKey' => ELFINDER_DROPBOX_CONSUMERKEY, 'consumerSecret' => ELFINDER_DROPBOX_CONSUMERSECRET, 'dropboxUid' => '', 'root' => 'dropbox', 'path' => '/', 'accessToken' => '', 'accessTokenSecret' => '' ) ) ); +++++++++++++++++++++++++++++++++++++++++++++++++++ And I am initializing it by

var f = $('#Elfinder').elfinder({ url :'currentfileurl' }).elfinder('instance');

Please please help me with this asap .

nao-pon commented 10 years ago

Hi DigvijaySinghChauhan,

You should use "Network mount" for Dropbox driver.

requires in "connector.php". ex. next...

// Required for Dropbox.com connector support
include_once dirname(__FILE__).DIRECTORY_SEPARATOR.'elFinderVolumeDropbox.class.php';
// # Dropbox volume driver need "dropbox-php's Dropbox" and "PHP OAuth extension" or "PEAR's HTTP_OAUTH package"
// * dropbox-php: http://www.dropbox-php.com/
// * PHP OAuth extension: http://pecl.php.net/package/oauth
// * PEAR's HTTP_OAUTH package: http://pear.php.net/package/http_oauth
//  * HTTP_OAUTH package require HTTP_Request2 and Net_URL2
// Dropbox driver need next two settings. You can get at https://www.dropbox.com/developers
define('ELFINDER_DROPBOX_CONSUMERKEY',    'xxxxxxxxxx'); // Your DROPBOX_CONSUMERKEY
define('ELFINDER_DROPBOX_CONSUMERSECRET', 'xxxxxxxxxx'); // Your DROPBOX_CONSUMERSECRET'

And NetMount-ing demo... http://youtu.be/S1Q_jGIwrzY

You can try dropbox net-mounting on http://hypweb.net/elFinder-nightly/demo/2.x_n/elfinder.html or http://hypweb.net/elFinder-nightly/demo/2.1_n/elfinder.html

helios-ag commented 10 years ago

Hi @nao-pon Can you provide, full working example configuration for dropbox driver (like here http://hypweb.net/elFinder-nightly/demo/2.1_n/elfinder.html#elf_l1_Lw)?

nao-pon commented 10 years ago

Hi helios-ag,

my connector setting is

<?php

error_reporting(0); // Set E_ALL for debuging

include_once dirname(__FILE__).DIRECTORY_SEPARATOR.'elFinderConnector.class.php';
include_once dirname(__FILE__).DIRECTORY_SEPARATOR.'elFinder.class.php';
include_once dirname(__FILE__).DIRECTORY_SEPARATOR.'elFinderVolumeDriver.class.php';
include_once dirname(__FILE__).DIRECTORY_SEPARATOR.'elFinderVolumeLocalFileSystem.class.php';
// Required for MySQL storage connector
// include_once dirname(__FILE__).DIRECTORY_SEPARATOR.'elFinderVolumeMySQL.class.php';
// Required for FTP connector support
// include_once dirname(__FILE__).DIRECTORY_SEPARATOR.'elFinderVolumeFTP.class.php';
// Required for Dropbox.com connector support
include_once dirname(__FILE__).DIRECTORY_SEPARATOR.'elFinderVolumeDropbox.class.php';
// # Dropbox volume driver need "dropbox-php's Dropbox" and "PHP OAuth extension" or "PEAR's HTTP_OAUTH package"
// * dropbox-php: http://www.dropbox-php.com/
// * PHP OAuth extension: http://pecl.php.net/package/oauth
// * PEAR's HTTP_OAUTH package: http://pear.php.net/package/http_oauth
//  * HTTP_OAUTH package require HTTP_Request2 and Net_URL2
// Dropbox driver need next two settings. You can get at https://www.dropbox.com/developers
define('ELFINDER_DROPBOX_CONSUMERKEY',    '[YOUR CONSUMER KEY]');
define('ELFINDER_DROPBOX_CONSUMERSECRET', '[YOUR CONSUMER SECRET]');

// Add PEAR Dirctory into include path
$incPath = get_include_path();
$addPath = '/[PATH TO YOUR CUSTOM PEAR]/PEAR';
if (strpos($incPath, $addPath) === FALSE) {
    set_include_path( $addPath . PATH_SEPARATOR . $incPath );
}
define('ELFINDER_DROPBOX_USE_CURL_PUT', true);

/**
 * Simple function to demonstrate how to control file access using "accessControl" callback.
 * This method will disable accessing files/folders starting from '.' (dot)
 *
 * @param  string  $attr  attribute name (read|write|locked|hidden)
 * @param  string  $path  file path relative to volume root directory started with directory separator
 * @return bool|null
 **/
function access($attr, $path, $data, $volume) {
    return strpos(basename($path), '.') === 0       // if file/folder begins with '.' (dot)
        ? !($attr == 'read' || $attr == 'write')    // set read+write to false, other (locked+hidden) set to true
        :  null;                                    // else elFinder decide it itself
}

// Documentation for connector options:
// https://github.com/Studio-42/elFinder/wiki/Connector-configuration-options
$opts = array(
    'debug' => true,
    'roots' => array(
        array(
            'driver'        => 'LocalFileSystem',   // driver for accessing file system (REQUIRED)
            'path'          => '../files/',         // path to files (REQUIRED)
            'URL'           => dirname($_SERVER['PHP_SELF']) . '/../files/', // URL to files (REQUIRED)
            'accessControl' => 'access'             // disable and hide dot starting files (OPTIONAL)
        )
    )
);

// run elFinder
$connector = new elFinderConnector(new elFinder($opts));
$connector->run();

next part

// Add PEAR Dirctory into include path
$incPath = get_include_path();
$addPath = '/[PATH TO YOUR CUSTOM PEAR]/PEAR';
if (strpos($incPath, $addPath) === FALSE) {
    set_include_path( $addPath . PATH_SEPARATOR . $incPath );
}
define('ELFINDER_DROPBOX_USE_CURL_PUT', true);

is optional. If you want use PUT method for save to Dropbox. It need dropbox-php/put_support in your /[PATH TO YOUR CUSTOM PEAR]/PEAR.