import hashlib


def calculate_file_hash(file_object):
	"""
	Calculate the sha256 hash of an uploaded file
	"""
	ctx = hashlib.sha256()

	if file_object.multiple_chunks():
		for data in file_object.chunks(ctx.block_size):
			ctx.update(data)
	else:
		ctx.update(file_object.read())

	return ctx.hexdigest()