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
Newbie10Newbie10 

force download of chatterfiles to a single location

My usecase is on click of a button,multiple chatter files should be downloaded at once.

Due to time constraints we are doing this by JS. Looping through URLS as below.But issue is download does happen but if there are three files.three windows are opened and download happens in separate window.is there a way to collect these and make it a better user experience.

This is the VF page

<apex:actionFunction name="clearitem" action="{!clearitems}" rerender="msgs" />
<apex:outputLink onClick="downloaditem();">
Download
</apex:outputLink>

This is the JS

 

<script type="text/javascript">
function downloaditem()
{
var SFObjectArray = new Array();
<apex:repeat value="{!chatterfileids}" var="arrayItem">
SFObjectArray.push('{!arrayItem}');
</apex:repeat>

var url = '{!url}';


for (var i = 0; i < SFObjectArray.length; i++)
{

window.open(url +SFObjectArray[i] );

}
}