V
V
Vladimir2022-04-10 05:41:58
Node.js
Vladimir, 2022-04-10 05:41:58

How to change the file size limit?

Hello. I have an application that complains that the file size is too large. Tried using express urlencoded and specifying 500*1024*1024 there, didn't work. I installed body-parser and tried again, similar and strange behavior here. Please tell me how can I fix this?

app.use(bodyParser.json({ limit: 500*1024*1024, extended: true }));
app.use(bodyParser.urlencoded({ limit: 500*1024*1024, extended: true }));


Thank you.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir, 2022-04-10
@HistoryART

Guys, firstly, it is correct to use one of the options:

app.use(bodyParser({ limit: 500*1024*1024, extended: true })); // или 1 (можно указать '500mb') например
app.use(bodyParser.json({ limit: 500*1024*1024, extended: true })); // или 2
app.use(bodyParser.urlencoded({ limit: 500*1024*1024, extended: true })); // или 3

Secondly, on the machine, you need to edit the nginx.conf config and add the following line to it:
client_max_body_size 5M;

Way:
/etc/nginx/nginx.conf

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question