英文:
Not able to POST/PUT image file from Win form application to external API
问题
Thanks in advance for looking into my issue.
Summary of my problem:
- 我有一个使用 HttpClient 在我的 Windows 窗体应用程序中消耗的 Node.js 外部 API。
- 我有一个端点用于编辑卖家详细信息。
- 我将要发布到 API 的数据既包括文本也包括文件(例如卖家名称 - 文本数据,卖家标志 - 图像文件)。
- 发送文本数据和文件(卖家标志)到 API 不起作用。
- 从 Postman 调用 API 端点并发送数据加文件是有效的。
请找到我目前拥有的代码的图像。
Postman 截图 (https://i.stack.imgur.com/WV7N1.png)
应用程序代码1 (https://i.stack.imgur.com/VvM8M.png)
应用程序代码2 (https://i.stack.imgur.com/3nIZm.png)
我希望能够将数据与图像文件一起发送到外部 API 端点。
英文:
Thanks in advance for looking into my issue.
Summary of my problem
- I have node.js external API that I am consuming in my win form application using HttpClient
- I have one end point that Edit seller detail
- Data that I will post to API have both text and file (eg sellerName - text data, sellerLogo - Image file)
- sending text data + file(seller logo) to api don't work
- Invoking API end point from postman and sending data plus file works
Please find images to my code that I currently have.
Postman Screenshot (https://i.stack.imgur.com/WV7N1.png)
Application code1 (https://i.stack.imgur.com/VvM8M.png)
Application code2 (https://i.stack.imgur.com/3nIZm.png)
I will like to able to send data along with image file to external api end point
答案1
得分: 0
以下是可运行的代码
可运行的代码
英文:
Below is working code
Working code
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论