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
case commentscase comments 

Adding attachments to visualforce page

I have a form in visualforce that's gathering customer information, but I would like to be able to also allow them to upload attachments to the form.  From what I've read, because I'm using the <apex:form> tag, I can't just use <apex:detail relatedlist="true"/>.  I would need to create a custom controller to handle the attachments.
I was thinking maybe having the customer input all the fields and upon hitting the submit button, that then goes to anohter VF page that asks them to enter attachments. Something like this:
http://bobbuzzard.blogspot.com/2011/01/uploading-multiple-attachments-via.html
That is where I'm finding difficult.  How would I go about doing that? Any help would be greatly appreciated.  Thanks.

<apex:page standardController="Drupal_UI_Assets__c" showHeader="true">
  <h1>Drupal UI Assets(JCORE)</h1>

  <apex:form >

  <apex:pageBlock >

  Please provide assets used to build demonstration sites and which will later be used for site development<p/>
  <b>Please state the jcode or journal name (if new journal)</b><p/>
  <apex:inputField value="{!Drupal_UI_Assets__c.JCode_or_Journal_Name__c}"/><p/>
 
  <b>Copy Drupal UI Asset Delivery Spreadsheet from the following journal </b><p/>
  Enter entries only for differences between two journals. Please use jcode for Highwire Journals and Journal Name for new launches<br/>
  <apex:inputfield value="{!Drupal_UI_Assets__c.Copy_from_following_journal__c}"/><p/>
  </apex:pageBlock>
  <apex:pageBlock title="Images">
  Please upload images using upload button at the bottom of the page<p/>
  </apex:pageBlock>
  <apex:pageblock title="Fonts">
  <b>Title Fonts</b><p/>
  Default: Georgia, Palantino, Times New Roman, Century Gothic<br/>
  <apex:inputfield value="{!Drupal_UI_Assets__c.Title_Fonts__c}"/><p/>
  <b>Menu/Body Text Font</b><p/>
  Default: Arial, Verdana, Gil Sans, Lucida Sans (Used for article body)<br/>
  <apex:inputfield value="{!Drupal_UI_Assets__c.Menu_Body_Text_Font__c}"/><p/>
  <b>Font Size</b><p/>
  Leave blank to use Highwire defaults<br/>
  <apex:inputfield value="{!Drupal_UI_Assets__c.Font_Size__c}"/><p/>
  <b>Labels Font Size</b><p/>
  Leave blank to use Highwire defaults<br/>
  <apex:inputField value="{!Drupal_UI_Assets__c.Labels_Font_Size__c}"/><p/>
  <b>Article Title Font Size</b><p/>
  Leave blank to use Highwire defaults<br/>
  <apex:inputField value="{!Drupal_UI_Assets__c.Article_Title_Font_Size__c}"/><p/>
  <b>Body Text Font Size</b><p/>
  Leave blank to use Highwire defaults<br/>
  <apex:inputField value="{!Drupal_UI_Assets__c.Body_Text_Font_Size__c}"/><p/>
  </apex:pageblock>
  <apex:pageblock title="Colors">
  <b>Please choose one of the following options:</b><br/>
  <apex:inputField value="{!Drupal_UI_Assets__c.Colors__c}"/><p/>
  <b>Primary Site Color</b><p/>
  Needed only if option 2 is selected<br/>
   <apex:inputField value="{!Drupal_UI_Assets__c.Primary_Site_Color__c}"/><p/>
   <b>Secondary Site Color</b><p/>
   Needed only if option 2 is selected<br/>
  <apex:inputField value="{!Drupal_UI_Assets__c.Secondary_Site_Color__c}"/><p/>
  <b>Navigation Bar Color(1)</b><br/>
  <apex:inputField value="{!Drupal_UI_Assets__c.Navigation_Bar_Color_1__c}"/><p/>
  <b>Page Background Color(2)</b><br/>
  <apex:inputField value="{!Drupal_UI_Assets__c.Page_Background_Color_2__c}"/><p/>
  <b>Content Background Color(3)</b><br/>
  <apex:inputField value="{!Drupal_UI_Assets__c.Content_Background_Color_3__c}"/><p/>
  <b>Button Color(4)</b><br/>
  <apex:inputField value="{!Drupal_UI_Assets__c.Button_Color_4__c}"/><p/>
  <b>Tab Background</b><br/>
  <apex:inputField value="{!Drupal_UI_Assets__c.Tab_Background__c}"/><p/>
  <b>Tab Text</b><br/>
  <apex:inputField value="{!Drupal_UI_Assets__c.Tab_Text__c}"/><p/>
  <b>Tab Active</b><br/>
  <apex:inputField value="{!Drupal_UI_Assets__c.Tab_Active__c}"/><p/>
  <b>Carousel Background</b><br/>
  <apex:inputField value="{!Drupal_UI_Assets__c.Carousel_Background__c}"/><p/>
  <b>Carousel Text</b><br/>
  <apex:inputField value="{!Drupal_UI_Assets__c.Carousel_Text__c}"/><p/>
  <b>Body Text</b><br/>
  <apex:inputField value="{!Drupal_UI_Assets__c.Body_Text__c}"/><p/>
  <b>Article Text</b><br/>
   <apex:inputField value="{!Drupal_UI_Assets__c.Article_Text__c}"/><p/>
  <b>Citation on Hover</b><br/>
   <apex:inputField value="{!Drupal_UI_Assets__c.Citation_on_Hover__c}"/><p/>
  <b>Abstract Popup</b><br/>
   <apex:inputField value="{!Drupal_UI_Assets__c.Abstract_Popup__c}"/><p/>
   <b>Article Correction Box</b><br/>
    <apex:inputField value="{!Drupal_UI_Assets__c.Article_Correction_Box__c}"/><p/>
  <b>Header Text</b><br/>
   <apex:inputField value="{!Drupal_UI_Assets__c.Header_Text__c}"/><p/>
  <b>Link Text</b><br/>
   <apex:inputField value="{!Drupal_UI_Assets__c.Link_Text__c}"/><p/>
  <b>Announcement Box</b><br/>
   <apex:inputField value="{!Drupal_UI_Assets__c.Announcement_Box__c}"/><p/>
  </apex:pageblock>
  <apex:pageblock title="Buttons and Icons">
  Default icons are at <apex:outputLink value="http://fortawesome.github.com/Font-Awesome/#icons-new"> http://fortawesome.github.com/Font-Awesome/#icons-new </apex:outputLink><p/>
  <b>Please provide location of custom icons if required</b><br/>
   <apex:inputField value="{!Drupal_UI_Assets__c.Location_of_custom_icons_if_required__c}"/><p/>
  </apex:pageblock>
  <apex:pageBlock title="Site Menus">
Please provide menu labels. Note if these are "buttons" or if they have a drop-down. If using drop-drowns, then please list these labels and the page they link to. Submenus are called out with "-" after ">"in the HighWire recommends section. <p/>
Home Content > -Current    -Ahead of Print    -Archive    -Most Read<br/>
Info for >    -Authors    -Reviewers    -Subscribers    -Institutions    -Advertisers    -Patients<br/>
About Us > -About Us -Contact Us -Editorial Board<br/>
More > -Alerts -Advertising -Feedback -Folders -Help<p/>
<b>Menu Labels</b><p/>
Copy template from above and modify if any changes are needed<br/>
  <apex:inputField value="{!Drupal_UI_Assets__c.Menu_Labels__c}"/><p/>
  <b>Display "Other Publication" menu dropdown in Top Level Menu </b><p/>
  Only applicable to sites under umbrellas<br/>
   <apex:inputField value="{!Drupal_UI_Assets__c.Display_Other_Publication_menu__c}"/><p/>
    </apex:pageBlock>
   <apex:pageblock title="Homepage Content Section">
   <b>Select what to display on the Homepage main content section</b><br/>
   <apex:inputfield value="{!Drupal_UI_Assets__c.Homepage_main_content_section__c}"/>
   Other:<apex:inputField value="{!Drupal_UI_Assets__c.Homepage_maint_content_section_Other__c}"/><p/>
   <b>Select to display on Homepage:</b><p/>
   These items span all columns of the homepage<br/>
   <apex:inputfield value="{!Drupal_UI_Assets__c.Homepage__c}"/>
    Other:<apex:inputField value="{!Drupal_UI_Assets__c.Homepage_Other__c}"/><p/>
   <b>Select which panels you would like to display in the Right column:</b><br/>
   <apex:inputfield value="{!Drupal_UI_Assets__c.Right_column__c}"/>
   Other:<apex:inputField value="{!Drupal_UI_Assets__c.Right_column_Other__c}"/><p/>
   </apex:pageblock>
   <apex:pageBlock title="Footer Section">
   <b>Display footer section on site?</b><br/>
   <apex:inputfield value="{!Drupal_UI_Assets__c.Footer_Section_on_site__c}"/><p/>
   <b>How many postscript columns should the footer section contain?</b><br/>
   <apex:inputfield value="{!Drupal_UI_Assets__c.Postscript_columns__c}"/><p/>
   </apex:pageBlock>
   <apex:pageBlock title="Advertising">
   <b>What pages should have advertisements?</b><p/>
   Please select the option that best fits. If "All Site Pages" is selected, there is no need to make additional selections<br/>
   <apex:inputfield value="{!Drupal_UI_Assets__c.Advertisements__c}"/><p/>
   <b>Who is the advertising provider?</b><br/>
   <apex:inputfield value="{!Drupal_UI_Assets__c.Advertising_provider__c}"/><p/>
   <b>Select where advertisements should appear:</b><p/>
   Position locations can be seen at <apex:outputLink value="http://jnl-reference.drupal-stage-jnl-web01.highwire.org"> http://jnl-reference.drupal-stage-jnl-web01.highwire.org </apex:outputLink><br/>
    <apex:inputfield value="{!Drupal_UI_Assets__c.Advertisements_should_appear__c}"/><p/>
    <b>Will every site page have the same advertisements and locations?</b><br/>
    <apex:inputfield value="{!Drupal_UI_Assets__c.Advertisements_and_locations__c}"/><p/>
   </apex:pageBlock>
   <apex:pageblock title="Citation">
   HighWire Default Style - <apex:outputLink value="https://na7.salesforce.com/501A0000000gOrG?srPos=0&srKp=501"> https://na7.salesforce.com/501A0000000gOrG </apex:outputLink><p/>
   <b>Select desired citation style:</b><br/>
   <apex:inputfield value="{!Drupal_UI_Assets__c.Citation_Style__c}"/><p/>
   <b>Please provide custom citation format if needed</b><br/>
   <apex:inputfield value="{!Drupal_UI_Assets__c.Custom_citation__c}"/><p/>
   </apex:pageblock>
   <apex:pageBlock title="Configurations (JCORE)">
   These items don't need to be delivered with the initial asset document but will be necessary for site building<br/>
   </apex:pageBlock>
   <apex:pageblock title="Social Media">
   Please provide links to Twitter, Facebook, linkedin. etc if you would like them displayed.<p/>
   <b>Where should the Social Media links be displayed?</b><p/>
   Default location is Top Level Menu<br/>
   <apex:inputfield value="{!Drupal_UI_Assets__c.Social_Media_links_displayed__c}"/> Other:<apex:inputfield value="{!Drupal_UI_Assets__c.Social_Media_displayed_Other__c}"/><p/>
   <b>Facebook Link</b><br/>
   <apex:inputfield value="{!Drupal_UI_Assets__c.Facebook_Link__c}"/><p/>
   <b>Twitter Link</b><br/>
   <apex:inputfield value="{!Drupal_UI_Assets__c.Twitter_Link__c}"/><p/>
   <b>LinkedIn Link</b><br/>
   <apex:inputfield value="{!Drupal_UI_Assets__c.LinkedIn_Link__c}"/><p/>
   <b>Additional Social Media Links</b><p/>
   Please add the Social Media name, image logo locatio and link location on each new line<br/>
   <apex:inputfield value="{!Drupal_UI_Assets__c.Additional_Social_Media_Links__c}"/><p/>
   </apex:pageblock>
   <apex:pageBlock title="Home Page Text Elements">
   <b>Please provide About the Journal Homepage Text</b><p/>
   Recommended length is 500 to 750 characters. (leave blank if not needed)<br/>
   <apex:inputfield value="{!Drupal_UI_Assets__c.About_the_Journal_Homepage_Text__c}"/><p/>
   <b>Please provide Announcement Homepage Text</b><p/>
   Recommended size is one line of text or 50 to 75 characters. (leave blank if not needed)<br/>
   <apex:inputfield value="{!Drupal_UI_Assets__c.Announcement_Homepage_Text__c}"/><p/>  
   </apex:pageBlock>
   <apex:pageblock title="Article Page Elements">
   <b>Provide preferred DOI format</b><br/>
    <apex:inputfield value="{!Drupal_UI_Assets__c.Preferred_DOI_format__c}"/><p/> 
    <b>Choose which functions to include from the list below</b><br/>
    <apex:inputfield value="{!Drupal_UI_Assets__c.Article_Page_Elements__c}"/><p/>
   <b>Display Social Sharing Widget?</b><p/>
   Displays link to tweet, facebook like, g+1, reddit ect...<br/>
   <apex:inputfield value="{!Drupal_UI_Assets__c.Social_Sharing_Widget__c}"/><p/>
   <b>Display Jump To Article Navigation Links?</b><br/>
   <apex:inputfield value="{!Drupal_UI_Assets__c.Jump_to_Article_Navigation_Links__c}"/><p/>
   <b>Display Issue Cover in Sidebar?</b><br/>
   <apex:inputfield value="{!Drupal_UI_Assets__c.Issue_Cover_in_Sidebar__c}"/><p/>
   <b>Article Navigtation Display style</b><p/>
   Floating will display the Jump to link when scrolling down the page<br/>
   <apex:inputfield value="{!Drupal_UI_Assets__c.Article_Navigation_Display_Style__c}"/><p/>
   <b>Display More in this TOC section accordion?</b><p/>
   Accordion expands to display more articles from the same Table of Contents section<br/>
   <apex:inputfield value="{!Drupal_UI_Assets__c.More_in_this_TOC_section_accordian__c}"/><p/>
   <b>Display More in this Related Articles accordion?</b><p/>
   Accordion expands to display more related articles and links to related articles in Pubmed and Google Scholar<br/>
    <apex:inputfield value="{!Drupal_UI_Assets__c.More_in_this_Related_Articles_accordion__c}"/><p/>
   <b>Display Subject Collections Widget?</b><p/>
   Displays subject collections associated with the article being viewed<br/>
   <apex:inputfield value="{!Drupal_UI_Assets__c.Subject_Collections_Widget__c}"/><p/>
   <b>Display Keywords in Article Body?</b><br/>
    <apex:inputfield value="{!Drupal_UI_Assets__c.Keywords_in_Article_Body__c}"/><p/>
   <b>Display Keywords in Column 2 Widget?</b><br/>
   <apex:inputfield value="{!Drupal_UI_Assets__c.Keywords_in_Column_2_Widget__c}"/><p/>
   </apex:pageblock>
   <apex:pageBlock title="Table of Contents Page Elements">
   <b>Display popup abstracts on Article listing pages?</b><p/>
   Article listing pages include issue Table of Contents, Published Ahead of Print Page<br/>
   <apex:inputfield value="{!Drupal_UI_Assets__c.Popup_abstracts_on_Article_listing_pages__c}"/><p/>
   <b>Display Jump to Table of Content Sections Navigation Links?</b><p/>
   Displayed by default<br/>
  <apex:inputfield value="{!Drupal_UI_Assets__c.Jump_to_TOC_Sections_Navigation_Links__c}"/><p/>
  <b>Display CME links for each article</b><p/>
  CME must be installed<br/>
  <apex:inputfield value="{!Drupal_UI_Assets__c.CME_links_for_each_article__c}"/><p/>
  </apex:pageBlock>
  <apex:pageBlock title="Collection Elements">
  <b>Does the site contain Subject Collections?</b><br/>
  <apex:inputfield value="{!Drupal_UI_Assets__c.Subject_Collections__c}"/><p/>
  <b>Expand Subject Collections listing by default?</b><p/>
  Default behavior shows listing expanded<br/>
  <apex:inputfield value="{!Drupal_UI_Assets__c.Expand_Subject_Collections__c}"/><p/>
  </apex:pageBlock>
  <apex:pageBlock title="Advanced Search Page Elements">
  <b>Please provide content for the Advanced Search snippet</b><p/>
  This text will appear at the top of the Advanced Search page<br/>
  <apex:inputfield value="{!Drupal_UI_Assets__c.Advanced_Search_snippet__c}"/><p/>
  <b>Display Advanced Page link next to Quick Search Box?</b><p/>
  The link will appear below the Quick Search Box<br/>
   <apex:inputfield value="{!Drupal_UI_Assets__c.Advanced_Page_link__c}"/><p/>
  <b>Display help pages for search?</b><br/>
   <apex:inputfield value="{!Drupal_UI_Assets__c.Help_Pages_for_Search__c}"/><p/>
    </apex:pageBlock>
   <apex:pageblock title="Archive Page Elements">
   <b>Provide preferred format or choose HighWire default.</b><p/>
   i.e. 7th: Vol 94, Issue 21<br/>
   <apex:inputfield value="{!Drupal_UI_Assets__c.Archive_Page_format__c}"/><p/>
   <b>Display cover hide/display option?</b><p/>
   Displays and hides issue covers on Archive listing<br/>
    <apex:inputfield value="{!Drupal_UI_Assets__c.Cover_Hide_Display_option__c}"/><p/>
    <b>Option to Refine Archives Search?</b><br/>
    <apex:inputfield value="{!Drupal_UI_Assets__c.Refine_Archives_Search__c}"/><p/>
   </apex:pageblock>

  
   <apex:commandButton action="{!save}" value="Submit"/>
  </apex:form>


</apex:page>
Damien Phillippi033905702927186443Damien Phillippi033905702927186443
You will need a controller extension to do this.  Basically, all you would need to do on this page is override your save() method in the Extension to
<pre>
return PageReference('/apex/YourNewPage?Id=' + yourObj.Id);
</pre>