来自 multer.js 的 req.files 示例
[
{
fieldname: files0,
originalname: 'Screenshot from 2020-05-23 01-52-30.png',
encoding: '7bit',
mimetype: 'image/png',
destination: 'public/uploads/projects/0a480789-eb14-4fe4-bb89-44aa741efe33/proposals/chma00000133',
filename: '1606822252923_Screenshot from 2020-05-23 01-52-30.png',
path: 'public/uploads/projects/0a480789-eb14-4fe4-bb89-44aa741efe33/proposals/chma00000133/1606822252923_Screenshot from 2020-05-23 01-52-30.png',
size: 172092
},
{
fieldname: files0,
originalname: 'Screenshot from 2020-05-22 08-44-05.png',
encoding: '7bit',
mimetype: 'image/png',
destination: 'public/uploads/projects/0a480789-eb14-4fe4-bb89-44aa741efe33/proposals/chma00000133',
filename: '1606822252925_Screenshot from 2020-05-22 08-44-05.png',
path: 'public/uploads/projects/0a480789-eb14-4fe4-bb89-44aa741efe33/proposals/chma00000133/1606822252925_Screenshot from 2020-05-22 08-44-05.png',
size: 440592
},
{
fieldname: files1,
originalname: 'Screenshot from 2020-05-30 11-36-42.png',
encoding: '7bit',
mimetype: 'image/png',
destination: 'public/uploads/projects/0a480789-eb14-4fe4-bb89-44aa741efe33/proposals/chma00000133',
filename: '1606822252930_Screenshot from 2020-05-30 11-36-42.png',
path: 'public/uploads/projects/0a480789-eb14-4fe4-bb89-44aa741efe33/proposals/chma00000133/1606822252930_Screenshot from 2020-05-30 11-36-42.png',
size: 477511
},
我想动态地将每个 JSON 对象与其字段名分组,并将它们存储在对象数组中,同时使用它们的字段名编号作为数组索引。
组可以在 0 到 9 之间,具体取决于用户输入。
潇潇雨雨
肥皂起泡泡
DIEA
相关分类