ng2文件上载设置了错误的内容类型



我遵循了本教程:https://valor-software.com/ng2-file-upload/

它在Postman上运行得很好,但当我在应用程序中尝试时,它就不起作用了。从api中,我返回文件,并从Postman中看到它们,但在我的应用程序中未定义。

我确实注意到,在我的应用程序中,我的请求内容类型设置为:

text/plain;charset=UTF-8

我试图设置为:

multipart/form-data

但后来出现了一个Boundry错误。

有什么建议吗?

我在服务器上更改了这个:

@UseInterceptors(FileInterceptor('files'))

至:

@UseInterceptors(FileInterceptor('file'))

它开始工作了,不知道邮递员为什么工作。

相关内容

最新更新