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

查看:35
本文介绍了使用 Postman 上传 ASP Core 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.

这是我在 Postman 中所做的:

Here is what I am doing in Postman:

我做错了什么?

推荐答案

感谢@rmjoia 的评论,我让它工作了!这是我必须在 Postman 中执行的操作:

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

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

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