【问题标题】:How to upload file to Amazon S3 pre-signed URL in Laravel?如何将文件上传到 Laravel 中的 Amazon S3 预签名 URL?
【发布时间】:2021-05-22 18:32:40
【问题描述】:

我为 Amazon S3 文件上传生成了一个预签名 URL。如何使用它的 HTTP 客户端(最好使用 PUT 方法)将文件上传到 Laravel 中的该 URL?

【问题讨论】:

  • 嘿,你找到答案了吗?
  • 是的,发布了这个问题的答案。

标签: laravel amazon-s3


【解决方案1】:

在尝试了几种方法后,我发现使用 Curl 是最好的解决方案。

我使用“ixudra/curl”composer 包发出 HTTP PUT 请求。

我的解决方案:

$response = Curl::to(url)
            ->withFile( 'data', path_to_file, '*' )
            ->withContentType('multipart/form-data')
            ->put();

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-12-10
    • 2021-08-18
    • 2020-09-30
    • 2015-10-13
    • 2016-07-12
    • 1970-01-01
    • 2018-12-27
    • 2019-04-18
    相关资源
    最近更新 更多