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
Akash Garg 2Akash Garg 2 

export to excel button download to ftp/network path directly

Hi
I have created a custom button on opportunity page to export data to excel of Opportunity Header and its Related List.
It download to local system when i click button.
How can I download it on a network path directly or FTP path??
VF Page:-
<apex:page Standardcontroller="Opportunity" extensions="Controller_QuotePage" contenttype="application/vnd.ms-excel#test.xls">
<apex:pageBlock >
<apex:pageBlockTable value="{!qt}" var="cs">
<apex:column value="{!cs.ID}" />
<apex:column value="{!cs.Name}" />
 </apex:pageBlockTable>
<apex:pageBlockTable value="{!LineItems}" var="cs1">
<apex:column value="{!cs1.ID}" />
<apex:column value="{!cs1.Name}" />
</apex:pageBlockTable>
</apex:pageBlock>
</apex:page>
Apex controller: -
public with sharing class Controller_QuotePage {
   public Opportunity qt {get; set;}
   public List<Opportunity_Product__c> theLineItems {get; set;}
   public Controller_QuotePage(ApexPages.StandardController controller) 
   {
       Id quoteID = ((Opportunity) controller.getRecord()).Id;
       loadQuote(quoteId);
       loadQuoteLineItems(quoteId);
    }    
    public List<Opportunity_Product__c> getLineItems(){
         
         return theLineItems;
    }  
   private void loadQuote(String quoteId) {
        this.qt = [Select Id, Name       
                   FROM Opportunity where    
                  Id=:quoteId];        
   }    
   private void loadQuoteLineItems(String quoteId) {
       this.theLineItems = [SELECT Id, Name                          
                             FROM Opportunity_Product__c WHERE Opportunity__c =:   
                             quoteId];             
    }
}

Please advice next