-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
2.1.27 LocalFileSystem upload error #2143
Comments
@bitbybit There is no API change of the Upload command. The Upload command requires |
Chrome console output:
Request body:
It works with 2.1.26 without any problem. |
"current" is included in the parameter. Are you using the APIv1 connector? Which connector? |
I am using PHP connector from composer: $elfinder = new \elFinderConnector(new \elFinder([
'locale' => 'ru_RU.UTF-8',
'bind' => [
/**
* Smart logger function
* Demonstrate how to work with elFinder event api
*
* @param string $cmd command name
* @param array $result command result
* @param array $args command arguments from client
* @param elFinder $elfinder elFinder instance
* @return void|true
* @author Troex Nevelin
**/
'mkdir mkfile rename duplicate upload rm paste put' => function($cmd, $result, $args, $elfinder) use($logger) {
$log = sprintf('[%s] ID: %s (%s) %s:', date('r'), (($logger['user'] != 'anon.') ? $logger['user']->getUsername() : 'ANONYMOUS'), $logger['ip'] , strtoupper($cmd));
foreach($result as $key => $value) {
if(empty($value)) {
continue;
}
$data = [];
if(in_array($key, ['error', 'warning'])) {
array_push($data, implode(' ', $value));
} else {
if(is_array($value)) { // changes made to files
foreach ($value as $file) {
$filepath = (isset($file['realpath']) ? $file['realpath'] : $elfinder->realpath($file['hash']));
array_push($data, $filepath);
}
} else { // other value (ex. header)
array_push($data, $value);
}
}
$log .= sprintf(' %s(%s)', $key, implode(', ', $data));
}
$log .= "\n";
if($fp = @fopen($logger['file'], 'a')) {
fwrite($fp, $log);
fclose($fp);
}
},
],
'roots' => [[
'driver' => 'LocalFileSystem',
'path' => $app->getRootDir().$app['config']['dir']['upload_path'].'/',
'attributes' => [
[
'pattern' => '/^\/promo/',
'read' => false,
'write' => false,
'locked' => true,
'hidden' => true,
],
],
'URL' => $request->getScheme().'://'.$request->getHost().'/'.$app['config']['dir']['upload_name'].'/',
'tmbPath' => $app->getRootDir().$app['config']['dir']['elfinder_cache']['tmb']['path'],
'tmbURL' => $request->getScheme().'://'.$request->getHost().$app['config']['dir']['elfinder_cache']['tmb']['url'],
'quarantine' => $app->getRootDir().$app['config']['dir']['elfinder_cache']['quarantine'],
'copyFrom' => false,
'copyTo' => false,
'uploadDeny' => ['all'],
'uploadAllow' => ['image', 'application/vnd.oasis.opendocument.text', 'application/msword', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'],
'uploadOrder' => ['deny', 'allow'],
/**
* @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
**/
'accessControl' => function($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
},
'acceptedName' => function($name) {
if(mb_substr($name, -4, null, 'UTF-8') === '.php') {
return false;
} else {
return strpos($name, '.') !== 0;
}
},
'disabled' => ['netmount', 'help'],
]],
]));
$elfinder->run(); Actually I do not remember when I started to use elFinder but I think it was already verison 2. |
Ok, Please remove |
I do not have such option: $elfinder.elfinder({
url: elf.url,
soundPath: '/editor/elfinder/sounds/',
lang: 'ru',
height: 600,
ui: ["toolbar","path","stat"],
allowShortcuts: false,
sync: 10,
}); I have several |
{"added":[{"isowner":false,"ts":1502884868,"mime":"image\/jpeg","read":1,"write":1,"size":"380015","hash":"l1_ZGltcy5qcGc","name":"dims.jpg","phash":"l1_Lw","tmb":1,"url":"..."}],"removed":[],"changed":[{"isowner":false,"ts":1502884858,"mime":"directory","read":1,"write":1,"size":0,"hash":"l1_Lw","name":"promo","rootRev":"","options":{"path":"","url":"...","tmbUrl":"...","disabled":["back","forward","netmount","mkdir","mkfile","copy","paste","cut","edit","extract","archive","zipdl","chmod"],"separator":"\/","copyOverwrite":1,"uploadOverwrite":1,"uploadMaxSize":9223372036854775807,"uploadMaxConn":3,"uploadMime":{"firstOrder":"deny","allow":["image"],"deny":["all"]},"dispInlineRegex":"^(?:(?:image|video|audio)|(?:text\/plain|application\/pdf)$)","jpgQuality":100,"archivers":{"create":[],"extract":[],"createext":[]},"uiCmdMap":[],"syncChkAsTs":1,"syncMinMs":10000,"i18nFolderName":0,"tmbCrop":1,"csscls":"elfinder-navbar-root-local"},"volumeid":"l1_","locked":1,"isroot":1,"phash":""}]} |
❔ It is very strange... Would you show the response of the initial request (cmd=open&target=&init=1&tree=1)? Is there a problem elFinder located in the public place? Please let me know the URL if it is open. |
I guess I found the reason. Error: $elfinder = new \elFinderConnector(new \elFinder([
'locale' => 'ru_RU.UTF-8', Uploaded ok: 'locale' => 'en_US.UTF-8' 🤔 |
OK, Please try edit elFinder.class.php L.1287 '%.1f%03d' to '%.1F%03d' $result['api'] = sprintf('%.1f%03d', self::$ApiVersion, self::$ApiRevision); to $result['api'] = sprintf('%.1F%03d', self::$ApiVersion, self::$ApiRevision); |
It solves the problem 👍 |
Yes! @bitbybit Thank you so much! 👍 I'll fix it! |
Hi
With new 2.1.27 version i get following result of uploading files (LocalFileSystem driver):
Is it expected behaviour? Did some APIs change?
The text was updated successfully, but these errors were encountered: