Working photo upload
Refactored code