27
Views
3
Comments
Download binary file in Mobile App in ODC

Hi everyone,

I’m currently working on a mobile app project using ODC (OutSystems Developer Cloud). After click file name in the UI, I need to download files (jpg, xlsx, etc.) that are returned from a Server Action in binary (base64) format.

I’m using File Transfer Plugin/WriteFile to create a local file and then use the returned URI. Along with that, I use File Viewer Plugin/OpenDocumentFromLocalPath with returned URI to preview the file, where Forge provides options for users to download. Currently working perfectly.

However, I now have a new requirement:

  • I want the file to start downloading immediately when the user clicks the file name

  • I do not want to open the preview screen

What I’ve tried so far:

  • Download Manager Plugin, but it doesn’t seem to work properly on iOS

  • FileTransferPlugin / DownloadFile, but it keeps throwing variable-related errors

Has anyone faced this issue before or knows how to handle this scenario?

Thanks in advance for your help.

2023-10-16 05-50-48
Shingo Lam

You can use js to create a link then click on the link to download the file. Please refer to the js sample below

UserImage.jpg
Alan Nguyen

Hi Shingo, I think JS does not work on mobile application

2025-07-22 10-30-27
Mandar Deshpande

Hi @Alan Nguyen 

On mobile (especially iOS), files are not downloaded in the traditional sense like desktop browsers. The OS usually requires either:

  • opening the file in a viewer, or 
  • explicitly handing it off to another app (share sheet / save to files)

For your requirement (download immediately without preview), instead of trying to skip interaction completely, change flow to:

  • Write file locally (you are already doing this)
  • Use a plugin that opens share options (Save to Files / WhatsApp / etc.)
  • Avoid File Viewer if preview is not needed.

If your goal is zero user interaction, I think it's not realistically supported on iOS due to security restrictions.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.