Refactor remote operation to upload file