File size limit on uploading files through the fileResources API

Hello,

Using DHIS2 version 40.5 and below patches, I could upload any file without any limits on file size using the fileResources API. But starting with version 40.6 and above I keep getting the error that the file size is limited to 10MB.

Is there a way to configure this limit?

This is the error I get from uploading a file more than 10MB in the Reports app

And this is the error when using the fileResources API

{
    "httpStatus": "Conflict",
    "httpStatusCode": 409,
    "status": "ERROR",
    "message": "File size can't be bigger than 10000000, current file size 11540603"
}

Hello @nnkogift , refer to your server administrator.

This is typically controlled by nginx (or whichever reverse proxy you have deployed). The directive to set for nginx is:

client_max_body_size 100M;

For Nginx:

Kind regards,

Abumere

1 Like

Hello @Abumere_Ejakhegbe

Thanks for your input. My nginx configuration does support up to 100MB of file upload, I have the client_max_body_size 100M; set in the nginx configuration.

Regards.

1 Like

This is controlled by a key in the dhis2.conf file

  /** Maximun size for files uploaded as fileResources. */
  MAX_FILE_UPLOAD_SIZE_BYTES("max.file_upload_size", Integer.toString(10_000_000), false),

seen here

This error message is coming from DHIS2 and not the reverse proxy. So, if you have set it on the reverse proxy, you will also need to do the same in your DHIS2 configuration file as well.

Best regards,
Jason

4 Likes

Thanks @jason

I will try this out

1 Like

Thanks for this:
For 100 MB I added this to the conf file:
max.file_upload_size = 100000000 and it is working.

2 Likes