如何在Node + react中增加上传文件的大小?
我成功上传了10万个计数的csv文件(14 mb)。
但对于500K或1000K.应用程序崩溃。
我看到类似的帖子,但使用express js来限制文件大小
我使用的是fetch
fetch(url, {
method: 'post',
credentials: "same-origin",
headers: {
'user_token': sessionStorage.getItem('token'),
'Accept': 'application/json',
'Content-Type':'application/json',
},
body: JSON.stringify({
'uploadedData': this.state.uploadedData,
}),
})
.then(response => response.json())
.then(json => {
})
}
我已经尝试删除
'Accept': 'application/json',
'Content-Type':'application/json',
或使用
'Content-Type':'multipart/form-data',
但这是行不通的
我使用的是laravel服务器,我也在php.ini上增加了上传文件大小的限制。仍然没有结果。
有什么办法来增加文件大小?
尝试在expressjs中增加限制的大小
app.use(bodyParser.json({ limit: '50mb' }));
app.use(bodyParser.urlencoded({ limit: '50mb', extended: true }));