fix image upload format and remove all uploaded file when contain error format before save