move uploadFile method to utils.