Refactor before updating classes controller for image upload.