file upload code restructure for edit service