public function deleteFile($name = null)
    {
        foreach ($this->getAllFields() as $field) {
            $path = $this->getFilePath($field, $name);
            if (!$path || !is_file($path) || !file_exists($path)) {
                continue;
            }
            unlink($path);
        }
        if ($name == $this->owner->getAttribute($this->fileField)
           && ($files = $this->getFileList())     
        ) {
            $this->owner->updateAttributes([$this->fileField => reset($files)]);
        }
        return true;
    }