Skip to Content
0

How to handle binary data in Safari?

Apr 28, 2017 at 09:56 AM

137

avatar image

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

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Best Answer
Apurv Dawra
May 04, 2017 at 01:30 PM
0

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.

Share
10 |10000 characters needed characters left characters exceeded
Sakthivel Elango
Apr 28, 2017 at 09:53 PM
0

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

Show 1 Share
10 |10000 characters needed characters left characters exceeded

Hi Sakthivel,

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

Regards,

Apurv

0