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
ran67ran67 

Multi File Upload in IE

Hai 

 

i have an requrement on multi file uploading which should support IE browser i have done so much search on this but still no result can anybody please help me on this is urgent .

 

 

 

 

 

Thanks 

Amritesh SinghAmritesh Singh

hey,

 

Where you want to save you file in Attachment uder Accounts or in Document.

My multiple uploading program in working fine in IE too.But i am attaching those file to accounts.

 

ran67ran67
ya it should Attachment under Accounts can you please post your code it might be help full to me
Amritesh SinghAmritesh Singh
<apex:page standardController="Account" extensions="MultipleUploadController">  
    <apex:form >  
        <apex:pageBlock title="Upload Multiple Attachment to Object">  
              
            <apex:pageBlockButtons >  
                <apex:commandButton value="Upload"  action="{!SaveAttachments}"/>  
            </apex:pageBlockButtons>  
              
            <apex:pageMessages id="MSG"/>  
            <apex:actionFunction name="ChangeCount" action="{!ChangeCount}"/>  
              
            <apex:pageblocksection >  
                              
                <apex:pageBlockSectionItem >  
                    <apex:outputLabel value="How many files you want to upload?"/>  
                    <apex:selectList onchange="ChangeCount() ;" multiselect="false" size="1" value="{!FileCount}">  
                        <apex:selectOption itemLabel="--None--" itemValue=""/>  
                        <apex:selectOptions value="{!filesCountList}"/>  
                    </apex:selectList>  
                </apex:pageBlockSectionItem>  
              
            </apex:pageblocksection>  
              
            <apex:pageBlockSection title="Select Files" rendered="{!IF(FileCount != null && FileCount != '', true , false)}">  
                <apex:repeat value="{!allFileList}" var="AFL">  
                    <apex:inputfile value="{!AFL.body}" filename="{!AFL.Name}" />  
                      
  
                </apex:repeat>  
            </apex:pageBlockSection>  
              
        </apex:pageBlock>  
    </apex:form>  
</apex:page>

 

Controller :

 

public with sharing class MultipleUploadInDocument_Controller {

        public List<SelectOption> filesCountList {get; set;}  
        
        public String FileCount {get; set;}  
          
        public List<Attachment> allFileList {get; set;}  
          
        public MultipleUploadInDocument_Controller ()  
        {  
           
        }  
       public MultipleUploadInDocument_Controller(ApexPages.StandardController controller)
       {
    
            filesCountList = new List<SelectOption>() ;  
            FileCount = '' ;  
            allFileList = new List<Attachment>() ;  
              
                 for(Integer i = 1 ; i < 11 ; i++)  
                filesCountList.add(new SelectOption(''+i , ''+i)) ;  
        }
  
        public Pagereference SaveAttachments()  
        {  
            String accId = System.currentPagereference().getParameters().get('id');  
            if(accId == null || accId == '')  
                ApexPages.addmessage(new ApexPages.message(ApexPages.Severity.ERROR,'No record is associated. Please pass record Id in parameter.'));  
            if(FileCount == null || FileCount == '')  
                ApexPages.addmessage(new ApexPages.message(ApexPages.Severity.ERROR,'Please select how many files you want to upload.'));  
      
            List<Attachment> listToInsert = new List<Attachment>() ;  
              
            for(Attachment a: allFileList)  
            {  
                if(a.name != '' && a.name != '' && a.body != null)  
                    listToInsert.add(new Attachment(parentId = accId, name = a.name, body = a.body)) ;  
            }  
              
           if(listToInsert.size() > 0)  
            {  
                insert listToInsert ;  
                ApexPages.addmessage(new ApexPages.message(ApexPages.Severity.INFO, listToInsert.size() + ' file(s) are uploaded successfully'));  
                FileCount = '' ;  
            }  
            else  
                ApexPages.addmessage(new ApexPages.message(ApexPages.Severity.ERROR,'Please select at-least one file'));  
                  
            return null;  
        }  
          
        public PageReference ChangeCount()  
        {  
            allFileList.clear() ;  
                for(Integer i = 1 ; i <= Integer.valueOf(FileCount) ; i++)  
                allFileList.add(new Attachment()) ;  
            return null ;  
        } 
}

 

Pass Account id in page url 

ran67ran67
Thanks you A singh
Amritesh SinghAmritesh Singh

If you got ur answer then pls mark this as a solution

ran67ran67
Hai A singh
in this we have to select one file at a time but i want to select multi files at a time
just like this link
http://www.script-tutorials.com/demos/257/index.html
ran67ran67
you can find one more example in chatter where we can select multi file at a time to upload . i need like that to be worked in visualforce page