+ Start a Discussion

If no logo is uploaded while creating a survey, then how to add default image to the survey

I am uploading the logo. but when logo is not selected i want to upload default image to the survey. How is it possible?

public with sharing class DocumentController {
 public Feedback_Main__c feedbackmain{get;set;}
 public ID folderid{get;set;}
 public Blob file{get;set;}

public DocumentController() {
feedbackmain = new Feedback_Main__c();
Organization org =[select Id,InstanceName from Organization limit 1];

//List<String>AcutalBaseUrl =BaseUrl.split('.');

public PageReference Manage(){
PageReference pg = new PageReference('apex/SBAddQuestionPage');
return pg;

public PageReference saveAndRedirect() {

 Id OrgId = UserInfo.getOrganizationId();
 Folder FolderObj = [Select Id From Folder Where Name = 'Survey Builder' limit 1];
 Document d= new Document();

 d.name = 'LOGO';
 d.body=file; // body field in document object which holds the file.
 d.IsPublic = true;
 d.ContentType ='image/png';
 d.Type = 'png';

 d.folderid = FolderObj.Id; //folderid where the document will be stored insert d;
 if (Document.SObjectType.getDescribe().isCreateable())
     insert d;
Organization org =[select Id,InstanceName from Organization limit 1];
//(Sandbox)feedbackmain.Image__c = '<img src="https://c.cs41.content.force.com/servlet/servlet.ImageServer?id='+d.id+'&oid='+OrgId+'"></img>';
feedbackmain.Image__c = '<img src="https://c.'+org.InstanceName+'.content.force.com/servlet/servlet.ImageServer?id='+d.id+'&oid='+OrgId+'"></img>';

  system.debug('++++++++++D ID+++++++++++'+feedbackmain.Image__c);
  insert feedbackmain; // This takes care of the details for you.
  PageReference redirectPage = Page.SBAddQuestionPage;
  return redirectPage;



<div class="formFeild"> <label>Upload Logo (5 MB Max. size)</label> <div class="feild"> <apex:inputfile value="{!file}" ></apex:inputfile> <!-- <apex:inputTextarea richText="true" value="{!feedbackmain.Image__c}" html-placeholder="Logo" styleClass="text-editor"/> --> </div>

Thanks & Regards,
Rowallim TechnologyRowallim Technology
Hi Satakshi
You can use if condition in controller.
    logo__c= '<img src="address.myimage.jpeg">;
Hope it will help you.