tonitin/post-s3

直接上传到s3

0.1.2 2024-06-13 00:37 UTC

This package is auto-updated.

Last update: 2024-09-13 01:20:51 UTC


README

这个库允许您从数据库模型中快速创建S3的post signed请求。

第一步

  • 在你的模型中包含S3PostSigned特质
use S3PostSigned;

以下是一个使用createPostSigned方法的示例

$post = new Post();
$sizeBytes = 80000;
$bucketName = 'example';
$key = 'xyz/abc/horse.mp3';
$postSigned = $post->createPostSigned($bucketName, $key, $sizeBytes);

示例响应

{
  "formAttributes": {
    "action": "endpointUrl",
    "method": "POST",
    "enctype": "multipart/form-data"
  },
  "formInputs": {
    "key": "xyz/abc/horse.mp3",
    "X-Amz-Credential": "xxxxxxxxx",
    "X-Amz-Algorithm": "xxxxxxxxx",
    "X-Amz-Date": "xxxxxxxxxxxxxxxxxxxxxxxx",
    "Policy": "xxxxxxxxxxxxxxxxxxxxxxxx",
    "X-Amz-Signature": "xxxxxxxxxxxxxxxxxxxxxxxx"
  }
}