简体   繁体   English

使用前端作为 vuejs 和后端作为 c# ASP.NET 将图像上传到 s3bucket

[英]Upload Image to s3bucket using front end as vuejs and backend as c# ASP.NET

I am passing我正在路过

Logo = event.target.files[0]

this value of input file from my vuejs to backened.这个从我的 vuejs 到 backed 的输入文件的值。 On my backend C# ASP.NET i am trying to get the value by在我的后端 C# ASP.NET 我试图通过

IFormCollection Logo

I don't know whether it is write method to send/recieve the file or I am sending right data or not.我不知道发送/接收文件是写方法还是发送正确的数据。 The problem is I really dont know how to recieve the file in C# and send it to s3 bucket.问题是我真的不知道如何接收 C# 中的文件并将其发送到 s3 存储桶。

You haven't shared much code with your attempt so I will give you a generic answer to work through.你没有与你的尝试共享太多代码,所以我会给你一个通用的答案来解决。

You can upload your files to ASP.NET Core by following this guide Upload files in ASP.NET Core .您可以按照本指南将文件上传到 ASP.NET 核心在 ASP.NET 核心中上传文件

If you do this, you will use the IFormFile interface, which has the OpenReadStream() method.如果这样做,您将使用具有OpenReadStream()方法的IFormFile接口。

You can then use the TransferUtility Upload method in the AWS SDK for .NET by passing the stream that you got from OpenReadStream() .然后,您可以通过传递您从OpenReadStream()获得的 stream 来使用 .NET 的 AWS SDK 中的TransferUtility Upload方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM