def upload(path, filename): path_file = '%s/%s'%(BASE, filename) if COMMON_PATH in path_file: path_upload = ROOT_PATH + path_file.rsplit(COMMON_PATH, 1)[1] print (' Upload to : %s' % path_upload) key = Key(bucket, path_upload) key.set_contents_from_filename(path_file) else: print (' Upload path not found.')