当前位置:网站首页>nodejs body-parser中间件处理类型 multipart/form-data 的 POST 表单数据,req.body无法接收到数据
nodejs body-parser中间件处理类型 multipart/form-data 的 POST 表单数据,req.body无法接收到数据
2022-07-27 12:32:00 【ray_zzzzz】
前端用multipart/form-data的形式上传数据,body-parser中间件无法获取到post传递的数据,可以使用中间件 connect-multiparty 替代
//安装 connect-multiparty
npm install connect-multiparty
使用方法
const multipart = require('connect-multiparty');
const multipartyMiddleware = multipart();
admin.post('/article-modify',multipartyMiddleware,(req,res)=>{
console.log(req.body, req.files);
;
req.body 是正常传递的数据,req.files则是上传的文件数据
边栏推荐
- 概述有名内部类与匿名内部类
- When the script runs in the background, it redirects the log from the console to its own named file
- 如何获取Class类对象
- While loop instance in shell
- 4. Analysis of the execution process of make modules for general purposes
- What are metauniverse and NFT digital collections?
- MySQL paging query instance_ MySQL paging query example explanation "suggestions collection"
- Docker MySQL Usage Note
- Check the number of file descriptors opened by each process under the system
- P1321 word overlay restore [getting started]
猜你喜欢

Fundamentals of mathematics 02 - sequence limit

Go replace with local code

Go Beginner (4)

详述HashSet的add方法

An overview of kernel compilation system

Use redis' sorted set to make weekly hot reviews

Multi activity disaster recovery construction after station B 713 accident | takintalks share

JVM memory model

20210512 recursive formula

Strictly control outdoor operation time! Foshan housing and Urban Rural Development Bureau issued a document: strengthening construction safety management during high temperature
随机推荐
HDU1698_Just a Hook
Do you really understand the underlying data structure skip list of Zset in redis?
After Party A's hard work, 49.08 million orders of China Mobile were scrapped
Photoshop web design tutorial
The bank's face recognition system was broken: a depositor was stolen 430000 yuan
ArrayList常用方法总结
Top 10 international NFT exchanges
20210519 leetcode double pointer
20210422 consolidation interval
Transactions in MySQL
How to use the server to build our blog
隔离级别
II. Analysis of the execution process of make menuconfig
Use redis' sorted set to make weekly hot reviews
Vi. analysis of makefile.build
Play CSDN editor
Necessary foundation: Signature Verification
【数据库数据恢复】SQL Server数据库所在磁盘分区空间不足报错的数据恢复案例
Interviewer: how can you close an order without using a scheduled task?
Watermelon book chapter 3 (first & second)