Static file in web app

We are working on a DHIS2 web app which has an Excel template file with certain metadata information. We allow uploading of Excel files filled with data - while uploading we use the template file for validating the uploaded file. Now, the template file is part of source code, means, it is part of the compiled app.

Is there any way so that we can have the Excel template out of the compiled app, so that if any update in the template file - we can just replace the file and the app continues working without compilation?

Does the dataStore allow Excel files instead of raw JSON?

@Mahmud no, the dataStore only supports JSON types. You can use the fileResources API to upload a file into DHIS2 (see the docs)

1 Like

Thanks @austin we have already used the file resource.
Although I am curious to know is there any limit on number of files that can be uploaded?
Any DHIS2 settings that we may have to tweak if the number of files/size exceed?
What is the folder where files are uploaded?

@dhis2-backend should be able to answer that for you!

Hi @Mahmud ,

There are no limits to number of files uploaded, for size, I think this might be restricted through your webserver like nginx, etc. But in DHIS2 we have no set limits at the moment.

Files are saved in your DHIS2_HOME folder, unless your instance is configured to use a cloud provider. In the latter case, files are saved in the cloud as configured in dhis.conf.

A last note: Files can be uploaded to one of several “domains”. Each domain decide how the file is used. For example, files uploaded as a data or attribute value will only be accessible to some people. However, the domain called DOCUMENT are the one I would assume you want to look at. These are static files available to every logged in user, in theory.

1 Like