egg icon indicating copy to clipboard operation
egg copied to clipboard

关于multipart/form-data 格式传递数据

Open dmodaii opened this issue 8 years ago • 3 comments

dmodaii avatar May 15 '18 03:05 dmodaii

Translation of this issue:


Passing data in multipart/form-data format

If passed the file file

Can indeed pass

Const stream = await this.ctx.getFileStream();

Get to file and other fiels

But only wear other fields

This function is incorrect, how to get all the data in the upload formData (this file is optional, there is no unified processing) I see online that is automatically judged to have a file when adding multipart/form-data, no file to use ordinary format to upload to handle, but very troublesome

egg-bot avatar May 15 '18 03:05 egg-bot

@dmodaii 你好,我遇到了和你一样的问题,但是不知道怎么解决,请问一下,您是如何解决的、

OctoberCity avatar Aug 30 '18 07:08 OctoberCity

@OctoberCity 仿照官方提供的 https://eggjs.org/zh-cn/basics/controller.html 里面的 ctx.multipart(); 遍历

dmodaii avatar Aug 30 '18 09:08 dmodaii