Elfinder: Reopen - Doesn't ask to overwrite existing file

Created on 19 Sep 2016  路  8Comments  路  Source: Studio-42/elFinder

I don't know how to configure Elfinder to do not overwrite existing file. A few years later it was possible by bind option "duplicate". Now I don't know how to configure that. When I upload the same file - elfinder don't ask for overwite and is not changing file name (eg. file_2, file_3 ..). Version 2.1.15.

$opts = array(
    'debug' => true,
    'bind' => array(
            'mkdir.pre mkfile.pre rename.pre' => array(
                'Plugin.Sanitizer.cmdPreprocess'
            ),
            'upload.presave' => array(
                'Plugin.Sanitizer.onUpLoadPreSave'
            )
        ),
  'uploadTempPath' => '/home/somewhere/_tmp',
  'roots' => array(
        array(
            'driver'        => 'FTP',
      'host'          => 'myhost',
      'user'          => 'myuser',
      'pass'          => 'mypass',
      'path'          => '/',
      'tmbPath' => '../files/ftptmb',
      'tmbURL' => dirname($_SERVER['PHP_SELF']) . '/../files/ftptmb',
      'tmpPath' => '/../files/tmp',
            'utf8fix'    => true,
      'fileMode'     => 0666,         // new files mode
      'dirMode'      => 0777,         // new folders mode
      'tmbPathMode'      => 0777,
      'URL'           => 'http://ftp.myhostsomewhere.pl/', // URL to files (REQUIRED)
      'alias'  => 'my FTP',
      'plugin' => array(
                'Sanitizer' => array(
                    'enable' => true,
                    'targets'  => array('膮','膭','膰','膯','臋','臉','艂','艁','贸','脫','艣','艢','偶','呕','藕','殴','艅','艃','\xb9','\xa5','\xe6','\xc6','\xea','\xca','\xb3','\xa3','\xf3','\xd3','\x9c','\x8c','\x9f','\xaf','\xbf','\xac','\xf1','\xd1','\xc4\x85','\xc4\x84','\xc4\x87','\xc4\x86','\xc4\x99','\xc4\x98','\xc5\x82','\xc5\x81','\xc3\xb3','\xc3\x93','\xc5\x9b','\xc5\x9a','\xc5\xbc','\xc5\xbb','\xc5\xba','\xc5\xb9','\xc5\x84','\xc5\x83','\xb1','\xa1','\xe6','\xc6','\xea','\xca','\xb3','\xa3','\xf3','\xd3','\xb6','\xa6','\xbc','\xac','\xbf','\xaf','\xf1','\xd1','$','!','@','%',' ','+','\\','/',':','*','?','"','<','>','|'),
                    'replace'  => array('a','a','c','c','e','E','l','l','o','o','s','s','z','z','z','z','n','n','a','a','c','c','e','e','l','l','o','o','s','s','z','z','z','z','n','n','a','a','c','c','e','e','l','l','o','o','s','s','z','z','z','z','n','n','a','a','c','c','e','e','l','l','o','o','s','s','z','z','z','z','n','n','-','-','-','-','-','-plus-','-','-','-','-','-','-','-','-','-')    // replace to this
                )
            ),
      'acceptedName' => 'validName',
            'accessControl' => 'access',             // disable and hide dot starting files (OPTIONAL)
      'attributes' => array(
            array(
                'pattern' => '/am$/', //You can also set permissions for file types by adding, for example, .jpg inside pattern.
                'read'    => true,
                'write'   => false,
            'hidden'   => true,
                'locked'  => true
            )
          )
        )
    )
);
howto question

All 8 comments

@santaclaus21 There is a volume roots option uploadOverwrite. Please try set 'uploadOverwrite' => false.

Thank you!

Is that possible to get any dialog (option) before overwite (without name change) ?

@santaclaus21 Do you want that there is no "backup" button in this dialog?
fireshot capture 8 - elfinder 2 1 x - file manager for web_ - http___studio-42 github io_elfinder_

I've never seen this ask (form) before :) I didn't set uploadOverwite yet and I had always overwitten file without any ask :) thanks again.

@nao-pon - dialog window will be open correct with 'uploadOverwrite' => true without Sanitizer.
If I upload file "test-1-a.txt" twice - Elfinder is asking for overwite.

But when I was trying to upload file "test 1 a.txt" twice - using Sanitizer - ask window (dialog) will not shown (file was overwitten without any question) because file after upload was "test-1-a.txt" and second one is "test 1 a.txt". It should be comparision between existing file vs. uploaded after Sanitizer.

I would like to get info about overwite working on send sanitized file name = existing files.
Is that possible?

@santaclaus21 Please check example in source code comments.

'bind' => array(
    'upload.pre mkdir.pre mkfile.pre rename.pre archive.pre ls.pre' => array(
        'Plugin.Sanitizer.cmdPreprocess'
    ),
    'ls' => array(
        'Plugin.Sanitizer.cmdPostprocess'
    ),
    'upload.presave' => array(
        'Plugin.Sanitizer.onUpLoadPreSave'
    )
),

Great! It's working fine! :) Thank you!

Was this page helpful?
0 / 5 - 0 ratings