Added upload function from hannesl