Upload updates

Build on the upgrade_to branch, which is still unmerged as well.
Doesn't make a real difference. With the code as is, if the file exists but isn't a directory, makedirs will raise an exception and the operation will fail. With the suggested changed, the exception will instead be raised when the file is created.