added functionality to upload and save images