updated uploading logic from cloud server