how to use os.path.splitext(self.file.name) in django code example Example: python file basename #basename with extension basename = os.path.basename(path)