joni2back / angular-filemanager

JavaScript File Manager Material Design Folder Explorer Navigator Browser Manager in AngularJS with CSS3 Responsive (with FTP in PHP / Java / Node)
https://joni2back.github.io/angular-filemanager/
MIT License
1.76k stars 577 forks source link

upload file name extension "." to "-" #278

Closed capitalfuse closed 7 years ago

capitalfuse commented 7 years ago

Dear Sir or Madam, I appreciate for the angular-filemanager application developers. I don't understand why upload file name extension changed to "-" from "." when uploaded a file from other PC. Example) changed "music.mp3" to "music-mp3". So, I changed the following code, inactive "private function normalizeName($name)" bridges/php-local/LocalBridge/FileManagerApi.php

    private function uploadAction($path, $files)
    {
        $path = $this->canonicalizePath($this->basePath . $path);

        foreach ($_FILES as $file) {
            $uploaded = move_uploaded_file(
                $file['tmp_name'],
                $path . DIRECTORY_SEPARATOR . $file['name'] --->changed here!
            );
            if ($uploaded === false) {
                return false;
            }
        }

        return true;
    }

Fixed by above method, but am I right???

durasj commented 7 years ago

Hello @capitalfuse,

yes, you are right! Dot in the ext. shouldn't be replaced. But the solution is not to simply disable the normalization but instead, I applied the normalization to the name of the file only. Thanks for reporting that!

Opened PR with the fix and it's also already available in the current bundle.

joni2back commented 7 years ago

fixed in #280