public class uploadAttachmentAssignmentController{ public Id recId{get;set;} public string fileName{get;set;} public Blob fileBody{get;set;} public boolean isSaved{get;set;} public Attachment myAttachment{get;set;} public uploadAttachmentAssignmentController(ApexPages.StandardController ctlr){ recId = ctlr.getRecord().Id; isSaved = false; } public PageReference UploadFile(){ isSaved = true; if(fileBody != null && fileName != null) { Attachment myAttachment = new Attachment(); myAttachment.Body = fileBody; myAttachment.Name = fileName; myAttachment.ParentId = recId; insert myAttachment; // isSaved = true; system.debug('############# value of isSaved'+isSaved); } return null; } }