function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
srilakshmi1.387861669756762E12srilakshmi1.387861669756762E12 

is there any file format that takes every thing(like image,text files..) and display as it is.

means for example (.jpg)  extention takes images,(.txt) extention takes text files ,but i want an extention that takes both(image,text files).
Sonam_SFDCSonam_SFDC
Hi srilakshmi,

Could you please elaborate on the use case..where do you wish to use this extension ?
This will help us understand the requirement better and suggest accordingly..
srilakshmi1.387861669756762E12srilakshmi1.387861669756762E12
apex page:

<apex:page Controller="InputFileAttachment">
  <apex:sectionHeader title="Attach File "/>
  <apex:form >
  <apex:pageBlock >
      <apex:pageBlockButtons >
          <apex:commandButton value="Attach New File" action="{!AttachNewFile}"/>
      </apex:pageBlockButtons>

      <apex:pageBlockSection >    
          <apex:inputFile value="{!Attach}"></apex:inputFile>        
      </apex:pageBlockSection>   
  </apex:pageBlock>
  </apex:form>
</apex:page>

apex class:

public class InputFileAttachment {
    public blob Attach {get;set;} 
    string CurrentId ;
  
    public InputFileAttachment ()
    {     
        CurrentId = ApexPages.CurrentPage().getParameters().get('Id');     
    }  
    public pagereference AttachNewFile()
    {
        try
        {
        delete [select id from Attachment where ParentId=:CurrentId];
        Blob b = Attach;
        Attachment At = new Attachment(Name ='NewFile'+'.jpg',body = b,parentId=CurrentId);
        insert At;      
        }Catch(Exception ee){}
        return null;
    }
}

i found a program to attach something(textfiles,images) to a record in sales force.here in this "Attachment At = new Attachment(Name ='NewFile'+'.jpg',body = b,parentId=CurrentId);"  statement ".jpg" is the extention so when ever i run this program images are attching  and displayed properly,but not text files. if i change extention to .txt it works for text files but not for images.so insted of .jpg,.txt  i want another  extention that takes both image,text file what ever it is i want to attach.(.html is not working)