Monday, November 5, 2012

Input File:

Input File:
A component that creates an input field to upload a file.Max file size 10MB

public class crInputFile {
    public crInputFile(ApexPages.StandardController controller) {
        Document d = (Document) controller.getRecord();
        d.folderid = UserInfo.getUserId(); //this puts it in My Personal Documents
    }                 
}

<apex:page standardController="Document" extensions="crInputFile">
    <apex:messages />
    <apex:form id="theForm">
      <apex:pageBlock >
          <apex:pageBlockSection >
            <apex:inputFile value="{!document.body}" filename="{!document.name}"/>
            <apex:commandButton value="Save" action="{!save}"/>
          </apex:pageBlockSection>
       </apex:pageBlock>
    </apex:form>
</apex:page>


No comments:

Post a Comment