You need to sign in to do that
Don't have an account?
udayarangareddy mekala
ATTACHMENT FILE &IMAGE UPLOAD
CONTROLLER
-----------
public class EmployeeRelatedList {
private Empolyee_Details__c empDetail;
public blob picture{get;set;}
public Integer counter {get; set;}
public EmployeeRelatedList(ApexPages.StandardController stdController) {
this.empDetail = (Empolyee_Details__c)stdController.getRecord();
}
public Pagereference save() {
try{
if(picture != null)
{
Attachment attachment = new Attachment();
attachment.body = picture;
insert attachment;
}
upsert empDetail;
return new Pagereference('/apex/Custom_pagenations');
}
catch(Exception e){
Apexpages.addMessage(new Apexpages.Message(Apexpages.Severity.ERROR, e.getMessage()));
return null;
}
}
}
VISUALFORCE PAGE
-----------------------
<apex:page standardController="Empolyee_Details__c" extensions="EmployeeRelatedList" tabStyle="Empolyee_Details__c">
<apex:form >
<apex:sectionHeader title="EmployeeInfo"/>
<apex:pageBlock title="EmployeeData">
<apex:pageBlockSection title="Empolyee basic Details" columns="2" collapsible="false">
<apex:inputField value="{!Empolyee_Details__c.EmpId__c}"/>
<apex:inputField value="{!Empolyee_Details__c.FirstName__c}"/>
<apex:inputField value="{!Empolyee_Details__c.LastName__c}"/>
<apex:inputField value="{!Empolyee_Details__c.MiddleName__c}"/>
<apex:inputField value="{!Empolyee_Details__c.DateofBirth__c}"/>
<apex:inputField value="{!Empolyee_Details__c.FatherMotherhusbandName__c}"/>
<apex:inputField value="{!Empolyee_Details__c.MartialStatus__c}"/>
</apex:pageBlockSection>
<apex:pageBlockButtons >
<apex:commandButton action="{!save}" value="SAVE"/>
</apex:pageBlockButtons>
<apex:inputfile value="{!Empolyee_Details__c.id}"></apex:inputfile>
</apex:pageBlock>
</apex:form>
</apex:page>
my requirement is i want to attahement the file as well as uplaod the image.i used the attachment object but i didint get any attatchment or image upload.
THANKS ®ARDS
RANGA
-----------
public class EmployeeRelatedList {
private Empolyee_Details__c empDetail;
public blob picture{get;set;}
public Integer counter {get; set;}
public EmployeeRelatedList(ApexPages.StandardController stdController) {
this.empDetail = (Empolyee_Details__c)stdController.getRecord();
}
public Pagereference save() {
try{
if(picture != null)
{
Attachment attachment = new Attachment();
attachment.body = picture;
insert attachment;
}
upsert empDetail;
return new Pagereference('/apex/Custom_pagenations');
}
catch(Exception e){
Apexpages.addMessage(new Apexpages.Message(Apexpages.Severity.ERROR, e.getMessage()));
return null;
}
}
}
VISUALFORCE PAGE
-----------------------
<apex:page standardController="Empolyee_Details__c" extensions="EmployeeRelatedList" tabStyle="Empolyee_Details__c">
<apex:form >
<apex:sectionHeader title="EmployeeInfo"/>
<apex:pageBlock title="EmployeeData">
<apex:pageBlockSection title="Empolyee basic Details" columns="2" collapsible="false">
<apex:inputField value="{!Empolyee_Details__c.EmpId__c}"/>
<apex:inputField value="{!Empolyee_Details__c.FirstName__c}"/>
<apex:inputField value="{!Empolyee_Details__c.LastName__c}"/>
<apex:inputField value="{!Empolyee_Details__c.MiddleName__c}"/>
<apex:inputField value="{!Empolyee_Details__c.DateofBirth__c}"/>
<apex:inputField value="{!Empolyee_Details__c.FatherMotherhusbandName__c}"/>
<apex:inputField value="{!Empolyee_Details__c.MartialStatus__c}"/>
</apex:pageBlockSection>
<apex:pageBlockButtons >
<apex:commandButton action="{!save}" value="SAVE"/>
</apex:pageBlockButtons>
<apex:inputfile value="{!Empolyee_Details__c.id}"></apex:inputfile>
</apex:pageBlock>
</apex:form>
</apex:page>
my requirement is i want to attahement the file as well as uplaod the image.i used the attachment object but i didint get any attatchment or image upload.
THANKS ®ARDS
RANGA
Apex Code
VF Page
All Answers
Apex Code
VF Page