image upload before refactor