cancel
Showing results for 
Search instead for 
Did you mean: 

How to handle binary data in Safari?

apurvdawra
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi All,

We have a requirement to handle the binary data in our application where we can consume the binary data in order to make the uploaded files downloadable to our local system.

In an ideal scenario for the browsers, we send the binary data of an attachment to the Cloud for Customer (C4C) server by the means of an API. Now, we are fetching this data, converting it to BLOB and using the following SAPUI5 library for the file download:

sap.ui.core.util.File.save (blob, fileNameWithoutExt, fileExtension, _mimeType, 'utf-8');

The above approach works in all the browsers except Safari, as Safari doesn’t support file download by BLOB. I have tried several approaches mentioned online where they use FileSaver.js file. It shows the file preview for PNG and JPG files, but doesn't download them.

Any help regarding handling the binary data in Safari which could result in a file download will be appreciated.

Thanks in advance,

Apurv Dawra

Accepted Solutions (1)

Accepted Solutions (1)

apurvdawra
Product and Topic Expert
Product and Topic Expert
0 Kudos

Solution: Apparently the problem was with the Safari browsers with versions <10.1. Since version 10.1, BLOB is being supported and SAPUI5 util mentioned above also works as expected.

Answers (1)

Answers (1)

former_member183518
Active Participant
0 Kudos

Have you set the header "Content-Disposition: attachment;" when you try to download the file ?

apurvdawra
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Sakthivel,

I tried the above approach but it didn't work for Safari.

Regards,

Apurv