No. Now you seem to have two IF flows and none of them check for any condition. Both will return false and nothing will happen… This task is not for a beginner. I mean there is a lot of different things to consider. Wether it is android or ios, how to save the local file path etc… But I’ll try to give an idea:
I suggest doing these flows:
You have to search for most of these flows and install them first. Also this is a test case, so I just have a page variable named fileUrl which should be changed to anything that contains your download url that you want to preview.
First we have to check if it is already downloaded. I used the “documents” folder, as that seems to be the same for both systems. So we will check if a document with the same name as the file from the download url can be found in the documents folder:
The formula in the properties tab is:
systemVars.fileSystem.directories.document+"/"+SPLIT(SPLIT(pageVars.fileUrl, "/o/")[1], "?")[0]
This splits the download url into 3 different parts, and gets the name of the uploaded file and adds that to the system directory path to find the file.
This flow returns a true / false value. So we can check for that in the IF flow:
If true, then it has already been downloaded so we can open the preview.:
Here use the same formula as the one that we used in the does the file exist flow.
If the file has not yet been downloaded then we need to download it:
These are the settings of the download files flow… On default it downloads to the downloads folder, but we want to make sure that the file is in the same folder which we want to check next time. So we have to move the file into that folder. This is why we need the “Move/rename file/directory” flow:
The formula here for the “source path” is:
outputs["Download files"].files[0].path
and for the target path is:
systemVars.fileSystem.directories.document+"/"+outputs["Download files"].files[0].name
If this flow throws an error, that is likely to happen if the directory yet doesn’t exist, we have to create the directory and retry the move file flow. This happens here:
Formula:
systemVars.fileSystem.directories.document
After we moved the file we can again use the preview file flow and it will now show from the local storage…
*Just a friendly reminder, if You are a new user, please read the
*That has pretty decent information on all the flow formulas that are available and how to use them.