Added method for saveFile and saveImage