Some items in list can have more than one attachment so I want some method downloading all these files with one click event.
this is download urls,
private showDetail(title_:string, content_:string, attachments_:any ): void {
var fileUrls = [];
if(attachments_.length > 0){
attachments_.map((attachment:any, index:number)=>{
fileUrls.push(this.props.siteUrl + attachment['ServerRelativeUrl'])
})
this.setState({fileUrls:fileUrls });
}
I also tested url it works but I need to download all files here is my download function, its spfx project:
private getAttachment(): void {
var fileUrls = this.state.fileUrls;
fileUrls.map((url:string, i:number)=>{
this.props.httpClient.get(url,SPHttpClient.configurations.v1)
.then((response: Response) => {
return response.json();
})
.then((response: any): void => {
this.setState({
status: `Successfully loaded ${response.value.length} items`,
items: response.value
});
}, (error: any): void => {
this.setState({
status: 'Loading all items failed with error: ' + error,
items: []
});
});
});
}
I am able to see these files in network as below;
how can I download these as files ?