How to share files with File Repository on Control Panel?

Introduction

You can share binary files within the platform, between platform users and with external users, if you make the file public.

See also: REST APIs on File Repository

How to use it?

1) Go to https://<platform_instance>/controlpanel/files/list . You can also find this link from the menu:

Then, click in Create.

A modal will pop up, and you have to write down the metadata, which are optional, and select the file that you want to share.

There are two types of Storage Mode: Mongo GridFS and Directory (File). The default choice is GridFS and is the one recommended for several reasons. Either way it is transparent to the user.

The platform allows to configure the maximum size of the files to be uploaded, through its Centralized Configuration.

By default, the limit in file size is 50 MB.

2) Once uploaded, you will see the file in the list:

By default, uploaded files are not public and not shared, so if you want to share it with platform users, or with external users, you must click on the 'share' or 'public' button. 

You can download the file by clicking the 'download' button or copying the url ('copy url to clipboard') if you plan to download it from a REST client.

Note: You need to provide credentials to download the file from a REST client if the file is not public.

Sharing

You can share the file with platform users by clicking the . You can allow users to read/write files.

You may also make the file public. In that case, anyone can download the file:  , for example: https://www.onesaitplatform.online/controlpanel/files/5bb779a8008920000b398abf

You can also use the REST API (REST APIs on File Repository) to make CRUD operations with binary files. 

Downloading the file

By default, if you click the Download button or paste the url in a browser, the file will be downloaded as an attachment, but if you add the request parameter 'disposition', with any value, you will get the content of the file in the body of the response, instead of the attachment, for example:

https://<platform_instance/controlpanel/files/5bd875f6f32bbb9ec5550977 will give you the file

but changing it to:

https://<platform_instance>/controlpanel/files/5bd875f6f32bbb9ec5550977?disposition=x

will allow you to visualize the file embedded in the explorer.