Refactored Upload method