public function upload($file, $dir = null, $createDimensions = false, $autonumber = true)
    {
        if ($file) {
            // Generate random dir
            if (! $dir) {
                $dir = str_random(8);
            }
     
            // Get file info and try to move
            $destination = Config::get('redminportal::image.upload_path') . $dir;
            
            if ($autonumber) {
                $filename = $this->autoNumberFile($destination, $file);
            } else {
                $filename = $file->getClientOriginalName();
            }
            
            $path        = RHelper::joinPaths(Config::get('redminportal::image.upload_dir'), $dir, $filename);
            $uploaded    = $file->move($destination, $filename);
     
            if ($uploaded) {
                if ($createDimensions) {
                    $this->createDimensions($path);
                }
     
                return $path;
            }
        }
    }