使用Postman上载ASP核心WebApi测试文件 [英] ASP Core WebApi Test File Upload using Postman

查看:202
本文介绍了使用Postman上载ASP核心WebApi测试文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个接受任意文件的端点:

I have created an endpoint that takes an arbitrary file:

[HttpPost()]
public async Task<IActionResult> CreateFile(IFormFile file)

当我用Postman测试时, file 始终为空。

When I test it with Postman, the file is always null.

这是我在邮递员中所做的事情:

Here is what I am doing in Postman:

< a href = https://i.stack.imgur.com/qzdqL.png rel = noreferrer>

我在做什么错了?

推荐答案

感谢@rmjoia的评论,我可以正常工作了!这是我在邮递员中要做的事情:

Thanks to @rmjoia's comment I got it working! Here is what I had to do in Postman:

这篇关于使用Postman上载ASP核心WebApi测试文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆