upload functionality refactored. Unit test to check response