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
vishwa attikerivishwa attikeri 

how to download in one click

Hi,

Please help me out from this issue,

 

I have to download more then one attachment by single button click .

 

Please any on can share some code sample

 

This is my code :

public List<String> GetSelectedAttachments()
    {
        if(selectedAttachments.size()>0)
		{
			integer j = selectedAttachments.size();
			String strURL;
			for(integer i=0; i<j; i++)
			{                      
				 strURL  = '/servlet/servlet.FileDownload?file='  + selectedAttachments[i].Id; 
				attLinks.add(strURL);
			}
			System.debug('&&&&&&&&&&'+attLinks.size());
			return attLinks;
        }
        else
			{
				return null;
			}
    }
<apex:repeat value="{!SelectedAttachments}" var="s">


<a href="somedoc.html" target="newWindow" onclick="window.open('{!s}', this.target); return false">click here</a>

</apex:repeat>

 

 

Thanks