Elfinder: S3 Driver outdated

Created on 17 Apr 2015  Β·  8Comments  Β·  Source: Studio-42/elFinder

"Please re-send this request to the specified temporary endpoint. Continue to use the original request endpoint for future requests."

First of all, your S3 class will not work at all as-is, the _save method signature doesn't match that of the class it descends from. Since that method simply returns false, I wasn't worried about changing:

protected function _save($fp, $dir, $name, $stat) ..

Now that I have that figured out, and my root set up as follows:

array(
    'driver' => 'S3',   
    'accesskey' => 'KEY!',
    'secretkey' => 'OTHERKEY!',
    'region' => 'us-west-1',
    'bucket' => 'portal-editor',
    'path' => 'images', 
    'URL' => 'https://s3-us-west-1.amazonaws.com/portal-editor/images/', 
    'tmbPath' => 'tmb',
),

I'm getting "Invalid backend configuration. Readable volumes not available."

Looking into the console, the actual request to connector.minimal.php is saying this:

{"error":["errConf","errNoVolumes"],"debug":["Driver "elFinderVolumeS3" : Please re-send this request to the specified temporary endpoint. Continue to use the original request endpoint for future requests."]}

Any tips?

Thanks,
Adam

connector documentation

Most helpful comment

@barryvdh that what I suggest I'm sure there are good maintained S3 implementations, so we should probably drop our driver for S3 in favour of flysystem

All 8 comments

NAVER - http://www.naver.com/

[email protected] λ‹˜κ»˜ 보내신 메일 <[elFinder] S3 - "Please re-send this request to the specified temporary endpoint. Continue to use the original request endpoint for future requests." (#1015)> 이 λ‹€μŒκ³Ό 같은 이유둜 전솑 μ‹€νŒ¨ν–ˆμŠ΅λ‹ˆλ‹€.


λ°›λŠ” μ‚¬λžŒμ΄ νšŒμ›λ‹˜μ˜ 메일을 μˆ˜μ‹ μ°¨λ‹¨ ν•˜μ˜€μŠ΅λ‹ˆλ‹€.


@OakBehringer, I am having the same issue now, have you found the solution so far ? thanks

NAVER - http://www.naver.com/

[email protected] λ‹˜κ»˜ 보내신 메일


λ°›λŠ” μ‚¬λžŒμ΄ νšŒμ›λ‹˜μ˜ 메일을 μˆ˜μ‹ μ°¨λ‹¨ ν•˜μ˜€μŠ΅λ‹ˆλ‹€.


For users who end up here with the same error message: this error is related to region settings as well as access policies in amazon. Just try to create a bucket for US standard region, and give permission to that bucket to a user that your keys are used - and it will be "fine". Fine ?? I could not manage to make it work for another region. Also I ended up using this code for _scandir function, as the original one did not work, this code is taken from another fork of the original driver
https://github.com/helios-ag/ElFinderPHP/blob/master/src/Driver/ElFinderVolumeS3.php#L355

    $s3path = preg_replace("/\/$/", "", $path);
    $s3path = preg_replace("/^\//", "", $s3path);

    try {
        $files = $this->s3->ListBucket(array('Bucket' => $this->options['bucket'], 'delimiter' => '/', 'Prefix' => $s3path))->ListBucketResponse->Contents;
    } catch (Exception $e) {
    }

    $finalfiles = array();
    $folders = array();
    foreach ($files as $file) {
        if (is_object($file) && isset($file->Key)) {
            if (preg_match("|^" . preg_replace("/^\//", "", $s3path) . '/' . "[^/]*/?$|", $file->Key)) {
                $fname = $file->Key;
                if (!$fname || $fname == preg_replace("/\/$/", "", $s3path) || $fname == preg_replace("/$/", "/", $s3path)) {
                    continue;
                }
                $finalfiles[] = preg_replace("/\/$/", "", $fname);
            } else {
                $matches = array();
                if ($res = preg_match("|^" . preg_replace("/^\//", "", $s3path) . '/' . "(.*?)\/|", $file->Key, $matches)) {
                    $folders[$matches[1]] = true;
                }
            }
        }
    }

    // Folders retrieved differently, as it's not a real object on S3
    foreach ($folders as $forlderName => $tmp) {
        if (!in_array(preg_replace("/^\//", "", $s3path)."/".$forlderName, $finalfiles)) {
            $finalfiles[] = preg_replace("/^\//", "", $s3path)."/".$forlderName;
        }
    }

    sort($finalfiles);
    return $finalfiles;

However, even though the mkdir, list directories/files and make file functions worked ok, I could not manage to get the upload working, so eventually I just ended up using this s3 driver.
https://github.com/whs/elFinder-driver

Though it does not support thumbnails for images, but all the rest functions are working fine for me !

Here my config for that for sydney region

'driver'        => 'S3',
"s3" => array(
    "key" => "your_key",
    "secret" => "your_secret",
    "region" => "ap-southeast-2"
),
'URL'           => 'https://s3-ap-southeast-2.amazonaws.com/bucket.name/foldername',
'path'          => 'foldername/',   // path relative to bucket
'bucket' => 'bucket.name',
'acl' => 'public-read',     // depends on your case
'uploadMaxSize' => '5M'

full list of regions here - http://docs.aws.amazon.com/general/latest/gr/rande.html#s3_region

I guess our S3 code is old and doesn't work anymore. Would be nice if someone could update current codebase or replace it with working one, otherwise I'd suggest removing S3 support from core package as unmaintained.

@nao-pon fyi

You can use the S3 flysystem driver with https://github.com/barryvdh/elfinder-flysystem-driver

@barryvdh that what I suggest I'm sure there are good maintained S3 implementations, so we should probably drop our driver for S3 in favour of flysystem

I'll update the docs to make sure they match

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mschlosser22 picture mschlosser22  Β·  4Comments

nicorac picture nicorac  Β·  4Comments

DaeMonSx picture DaeMonSx  Β·  4Comments

CodeLyokoXtEAM picture CodeLyokoXtEAM  Β·  4Comments

CodeLyokoXtEAM picture CodeLyokoXtEAM  Β·  3Comments