Hello everyone,

I’m trying to use BaseX RESTXQ to upload some large (around 300MB) Zip files using HTML forms (multipart/form-data), save them to disk and then process them.

But I am getting server errors with large files (small files work perfectly).

HTTP ERROR 500

Problem accessing /test.htm. Reason:

    Server Error

Caused by:

java.lang.OutOfMemoryError: Java heap space

Powered by Jetty:// 9.4.9.v20180320

It seems to be when reading the file from the map of files.

1) Upload large file but do nothing with it - WORKS

2) Upload large file and just write the whole POST data to file - WORKS

3) Upload large file and write file from map - ERROR

This is the file writing function I’m using:

file:write-binary( "/Users/me/Desktop/delete2.zip”, $files(map:keys($files)[1]) )

Running BaseX 9.1

Is there something really obvious that I’m doing wrong? (There usually is :) )

Many thanks, James