PRE-REQUISITES

By default files stored on Fliplet’s file manager are encrypted for security reasons. Consequently it’s not possible to share a file with users that are not logged in to an app (as they won’t be able to decrypt the file). So to use the following code, your app will need to have a login component and a user will need to be logged in to view the file.

You can access a file stored in Fliplet’s file manager or online using the URL for that file (please note the prerequisite section, you will need to be logged in). To get the URL of a file stored on Fliplet, open the file manager in Fliplet Studio, navigate to the file you want, double click it and it will open in a new browser tab. The URL for the file is in the browser’s URL window of that tab.

Once you have the URL, you can access display the file in your app with the code below. In this example, we’ve assumed that there is a button component with a class name of ‘my-button’ (learn how to add class names here). When the button is clicked, it will get the file using the URL provided.

$('.my-button').on('click', function () {
  Fliplet.Navigate.file('https://api.fliplet.com/v1/media/files/1234/contents/image.jpg');
});

File types can include images (jpg, png) and pdfs and will work for other file types provided the user has the ability to download and open them.