Upload image refactoring