public function renameFile(StorageFacilityParams $params, StorageFacilityFile &$file, $newfileid)
    {
        $this->validateFileID($newfileid);

        if ($file->getId() == null)
            throw new StorageFacilityException("Invalid fileid '".$file->getId()."'");

        if ($this->fileExists($params, $newfileid))
            throw new StorageFacilityException("New file already exists '".$newfileid."'");

        if (!$this->fileExists($params, $file->getId()))
            throw new StorageFacilityException("File does not exist '".$file->getId()."'");

        if (!@rename($this->generateStoragePath($params, $file->getId()),
                $this->generateStoragePath($params, $newfileid)))
            throw new StorageFacilityException("Could not rename file '".$file->getId()."'");

        $file->setId($newfileid);
        $file->setUrl($this->generateUrl($params, $newfileid));
    }