Aquí está el código para crear la página de adjuntos de oportunidad en la página de fuerza visual.
Desde la consola de desarrolladores elige el archivo nuevo.
Seleccione la página de Visualforce e inserte el código.
Guarde el archivo como UploadAttachment.vfp
<apex:page standardController="Contact" tabStyle="Contact" extensions="UploadAttachmentController">
<apex:sectionHeader title="{!Contact.Name}" subtitle="Attach File"/>
<apex:form id="form_Upload">
<apex:pageBlock >
<apex:pageBlockButtons >
<apex:commandButton action="{!back}" value="Return to {!Contact.Name}"/>
<apex:commandButton action="{!back}" value="Cancel"/>
</apex:pageBlockButtons>
<apex:pageMessages />
<apex:pageBlockSection columns="1">
<apex:pageBlockSectionItem >
<apex:outputLabel value="File" for="file_File"/>
<apex:inputFile id="file_File" value="{!fileBody}" filename="{!fileName}"/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel value="Is the file for COMIT?" for="visible"/>
<apex:selectList value="{!selectedComit}" size="1" id="visible">
<apex:selectOption itemValue="false" itemLabel="No"/>
<apex:selectOption itemValue="true" itemLabel="Yes"/>
</apex:selectList>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel value="Subject" for="Subject"/>
<apex:inputTextarea id="subject" value="{!subject}" rows="1" cols="75"/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel value="Type" for="type"/>
<apex:selectList value="{!selectedType}" size="1" id="type">
<apex:selectOption itemValue="Contracts" itemLabel="Contracts"/>
<apex:selectOption itemValue="email" itemLabel="email"/>
<apex:selectOption itemValue="Expedited" itemLabel="Expedited"/>
<apex:selectOption itemValue="Finance" itemLabel="Finance"/>
<apex:selectOption itemValue="Legal" itemLabel="Legal"/>
</apex:selectList>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel value="" for="uploadBtn"/>
<apex:commandButton id="uploadBtn" value="Attach File" action="{!processUpload}" />
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>