Category: UI Widgets
Updated

This solution is summarized from an archived support forum post. This information may have changed. If you notice an error, please let us know in Discord.

Filepicker upload file bigger than 5Mb,catch uncaughtPromiseRejection

Issue

I am using a filepicker widget to upload files with a data format set to Base64 and a max file size of 50. However, when I try to upload files bigger than 5MB, I get an exception. How can I upload files larger than 5MB?

Resolution

To upload files larger than 5MB using the filepicker widget, you need to update your API configuration to increase the timeout limit. This is because files larger than 5MB are stored as blobs, which take more time to upload. Once you've increased the timeout, you can try uploading the file again and see if it works.

Here's an example of how to increase the timeout using ExpressJS:

const express = require('express');
const app = express();

// increase timeout to 10 minutes
const timeout = 600000;
app.use(express.timeout(timeout));

// handle file upload route
app.post('/upload', (req, res) => {
// your upload logic goes here
});

In this example, we're setting the timeout to 10 minutes (600000 milliseconds) using the express.timeout() middleware. This middleware will automatically set the req.timeout property if the request takes longer than the specified timeout. You can then handle this timeout however you like in your upload logic.

Keep in mind that increasing the timeout can have other implications, such as longer response times and increased risk of server overload. Make sure to test your solution thoroughly before deploying it to production.