亚马逊(AWS)S3预签名URL [英] Amazon (AWS) S3 Presigned URL

查看:591
本文介绍了亚马逊(AWS)S3预签名URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Visual Studio中使用Amazon SDK.我正在尝试使用File.Copy命令将文件上传到S3位置.

AWS开发工具包提供了一种生成预签名URL的服务,以便可以上传或下载文件.我有这个,但是当我尝试使用它时,会引发错误. 非法字符". URL的最后一部分是%2FRFfYsyil%2BTsk%3D".

使用的代码段为:

I am using the Amazon SDK in Visual Studio. I am trying to upload files to the S3 location using the File.Copy command.

The AWS SDK provides a service to generate a pre-signed URL so that files can be uploaded or downloaded. I have this, but when I try to use it, and error is thrown. "Illegal Character". The last part of the URL is "%2FRFfYsyil%2BTsk%3D".

The code snippet used is:

Dim isrc As String = "C:\Test\Test1.doc"
Dim iDest As String = upldurl & "\Test1.doc"

Try
    File.Copy(isrc, iDest, True)

Catch ex As Exception
    MsgBox("Error occured during upload of file: " & iflnm & vbCrLf & _
           "ERROR: " & ex.ToString)

End Try

推荐答案

嗨凯文,

我认为无法通过File.Copy
完成此操作
以下文章是一个很好的示例,说明了如何将文件上传到AWS S3.

PHP AWS开发工具包(S3) [从Amazon S3开始 [为网络上传带有AWS开发工具包的图像 [ ^ ]

我知道这不是解决方案,但您可以尝试一下.我看到您的代码在VB.Net中,但是这些链接在C#中.抬起头来.

更新:刚刚找到了另一个用于简单文件上传示例的链接.检查第三个.
Hi kevin,

I don''t think this can be done through File.Copy

The below articles are a very good examples of how files can be uploaded to AWS S3.

PHP AWS SDK (S3)[^]

Beginning with Amazon S3[^]

uploading an image with aws sdk for net[^]

I know this is not the solution but you can give it a try. I see your code is in VB.Net but these links are in C#. Just a Heads up.

UPDATE: Just found another link for simple File upload Example. Check the third one.


这篇关于亚马逊(AWS)S3预签名URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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