Mongoose always buffers a full HTTP message before invoking MG_EV_HTTP_MSG event. Big POST request require of lot of RAM to buffer everything.

In order to upload large files to a memory-constrained system, use MG_EV_READ on a server side. It fires when a partial HTTP message has been received. We discourage this method, since the client can send chunked-encoded data. Instead, please split the upload into smaller pieces and send sequentially.

In this example, JavaScript code uses "fetch()" browser API. Uploaded file is not saved, but rather printed by server side.
Selected file: