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

want help in Visualforce page

ill  tell what is doing  this scenario and what i want (please Help)
1 >So here i created Visualforce Page in that i have given some fields so when i save this its shows me on the sales order. This all i created in a standard format.
2>but right now what I want there is an upload button if data will upload then its  sent to the( sales order object there is a child product object) there i want to show. 
So here is My Vf code
<apex:page standardController="Opportunity" sidebar="flase" showHeader="false">
<apex:form >

<apex:pageBlock title="Sales Order">
  <apex:pageBlockSection title="Information" collapsible="false" columns="1">
    <apex:inputField value="{!Opportunity.Name}"/>
    <apex:inputField value="{!Opportunity.CloseDate}"/> 
    <apex:inputField value="{!Opportunity.StageName}"/>
  <apex:pageBlockSection title="Product">
  <apex:commandButton value="Upload File"/>
 <apex:pageBlockButtons location="bottom">
    <apex:commandButton value="Save" action="{!save}"/>
    <apex:commandButton value="Cancel" action="{!cancel}"/>
</apex:page>User-added image
mukesh guptamukesh gupta
Hi Yash,

Please follow below example:
<apex:page controller="RegisterandSaveCSVFileClass">
    <apex:form >
        <apex:pageBlock >
            <apex:messages />
            <apex:pageBlockSection columns="2" showHeader="true" title="Project Details" >
                <apex:inputField value="{!newProject.Name}"/>
            <apex:pageBlockSection >
                <apex:inputfile value="{!attachment.body}" filename="{!attachment.Name}" />
                <apex:commandbutton value="Upload and save" action="{!saveButtonAction}"/>

Apex class:-
public class RegisterandSaveCSVFileClass {    
    public Project__c newProject {get; set;}
    public Attachment attachment {get;set;}    
    public RegisterandSaveCSVFileClass(){
        newProject = new Project__c();
        attachment = new Attachment();
    public void saveButtonAction(){
        if(newProject.Name != null){
            insert newProject;               
                attachment.parentid =;
                insert attachment;                
                ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.FATAL,'You need to upload only CSV document');
                return ;

if you need any assistanse, Please let me know!!

Kindly mark my solution as the best answer if it helps you.