Fix upload directory

Old temporary directory was removed, so use os.tmpdir().