public function handleUploadedFiles(UploadedFile $file, $extension, $dir)
    {
        $original_file = $file->getClientOriginalName();
        $path_parts = pathinfo($original_file);

        $increment = '';
        while (file_exists($dir . FileManager::DS . $path_parts['filename'] . $increment . '.' . $extension)) {
            $increment++;
        }

        $basename = $path_parts['filename'] . $increment . '.' . $extension;
        $file->move($dir, $basename);
    }
public function handleUploadedFiles(UploadedFile $file, $extension, $dir)
    {
        $original_file = $file->getClientOriginalName();
        $path_parts = pathinfo($original_file);

        $increment = '';
        while (file_exists($dir . FileManager::DS . $path_parts['filename'] . $increment . '.' . $extension)) {
            $increment++;
        }

        $basename = $path_parts['filename'] . $increment . '.' . $extension;
        $file->move($dir, $basename);
    }
public function handleUploadedFiles ( UploadedFile $ file , $ extension , $ dir ) { $ original_file = $ file -> getClientOriginalName ( ) ; $ path_parts = pathinfo ( $ original_file ) ; $ increment = '' ; while ( file_exists ( $ dir . FileManager :: DS . $ path_parts [ 'filename' ] . $ increment . '.' . $ extension ) ) { $ increment ++ ; } $ basename = $ path_parts [ 'filename' ] . $ increment . '.' . $ extension ; $ file -> move ( $ dir , $ basename ) ; }
Upload the files

@param UploadedFile $file
@param string       $extension
@param string       $dir
Upload the files