You need to sign in to do that
Don't have an account?
Using <apex:inputFile>
public class TechSpecController {
rfqId Id;
Attachment att;
public TechSpecController(ApexPages.StandardController theController){
this.spec = (SDV_Tech_Specification__c) theController.getRecord();
rfqId = ApexPages.currentPage().getParameters().get('rfq');
att = new Attachment();
}
public PageReference attach() {
att.ParentId = rfqId;
insert att;
return ApexPages.currentPage();
}
}
I'm having trouble tying the <apex:inputFile> to the attachment field. I'm getting the error: Unknown property 'SDV_Tech_Specification__cStandardController.att'
<apex:page standardController="SDV_Tech_Specification__c" extensions="TechSpecController" showHeader="false">
<apex:inputFile value="{!att.body}" filename="{!att.name}"/>
</apex:page>
Obviously it's looking for a variable in the standardController, so I guess my question is: Can you use an extension and refer to the fields within that extension in the way I'm trying to? If not, is there another way to do it?
Your 'att' property cannot be seen by the page because it has default visibility, which equates to private in Force.
Change your declaration to:
public Attachment att {get; set;}
and you should be good to go.