![](https://img-blog.csdnimg.cn/20201014180756926.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
nodejs
qq_45209973
这个作者很懒,什么都没留下…
展开
-
multer结合FormData多文件上传
tips 记录一下使用multer 和 FormData 多文件上传的几个注意点和具体过程 页面 input 元素添加 multiple 属性 创建formdata实例,将文件迭代添加到imgs字段;必须添加到同一个字段 将formdata作为fetch的 body 发送;注意,不要添加任何响应头(我之前就是自作聪明添加了"Content-Type":“multipart/form-data”,一直没有成功),它会自动设置的 <!DOCTYPE html> <html lang="en原创 2020-07-08 19:07:24 · 493 阅读 · 0 评论 -
multer 文件上传
文件上传 使用的是 express 搭建的 nodejs 服务器 form 表单 注意设置 enctype: multipart/form-data 属性,否则服务器将无法正确解析表单数据 <form action="/api/upload" method="POST" enctype="multipart/form-data"> <p> <input type="file" name="img123" accept="image/*"> &l原创 2020-06-11 12:30:41 · 141 阅读 · 0 评论