Controller/UploadController.php
protected function createUniquePath(UploadedFile $file)
    {
        $dir = 'mmmb/'.mb_substr(mb_strtolower((string) $file->getClientOriginalName()), 0, 2);

        $filename = str_replace(array(' ', $file->getClientOriginalExtension()), '-', $file->getClientOriginalName());

        $name = mb_strtolower($filename.uniqid().'.'.$file->getClientOriginalExtension());

        return array(
            'dir' => $dir,
            'filename' => $name,
            'path' => $dir.'/'.$name,
        );
    }
protected function createUniquePath(UploadedFile $file)
    {
        $dir = 'mmmb/'.mb_substr(mb_strtolower((string) $file->getClientOriginalName()), 0, 2);

        $filename = str_replace(array(' ', $file->getClientOriginalExtension()), '-', $file->getClientOriginalName());

        $name = mb_strtolower($filename.uniqid().'.'.$file->getClientOriginalExtension());

        return array(
            'dir' => $dir,
            'filename' => $name,
            'path' => $dir.'/'.$name,
        );
    }
return a unique filepath.

@param UploadedFile $file

@return array