Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/amazon-s3/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reactjs 在s3上上传froala图像_Reactjs_Amazon S3_Froala - Fatal编程技术网

Reactjs 在s3上上传froala图像

Reactjs 在s3上上传froala图像,reactjs,amazon-s3,froala,Reactjs,Amazon S3,Froala,我正在应用程序中使用react-froala所见即所得编辑器。但是我在s3 bucket上上传图片时遇到问题。当我尝试在s3上上传图像时;s3返回错误禁止:403 任何人都可以在s3 for reactjs上共享上传图像的配置 以下是我的配置。 var配置={ imageUploadToS3:{ bucket:“testing-s3upload”, //你的桶区域。 地区:'us-east-1', keyStart:“froalaUploads/”, 参数:{ acl:“公共读取”, AWSA

我正在应用程序中使用react-froala所见即所得编辑器。但是我在s3 bucket上上传图片时遇到问题。当我尝试在s3上上传图像时;s3返回错误禁止:403

任何人都可以在s3 for reactjs上共享上传图像的配置

以下是我的配置。

var配置={
imageUploadToS3:{
bucket:“testing-s3upload”,
//你的桶区域。
地区:'us-east-1',
keyStart:“froalaUploads/”,
参数:{
acl:“公共读取”,
AWSAccessKeyId:'xxxxxxxxx',
AWSSecretAccessKey:'xxxxxxxxxxxxxxxxxxxxx',
策略:“”,//我没有在我的存储桶上应用任何策略。
签名:'',
}
}

}
查看froala编辑器文档:

为了将图像上传到S3,需要计算 使用AWS访问密钥ID和AWS秘密访问密钥签名 并将其与上载请求一起提供。富文本编辑器 Ruby SDK提供了使用V4计算S3签名的方法 签名算法,适用于在任何S3上创建的存储桶 地区

他们还提供了一个样本:

class UploadController < ActionController::Base

  ...

  def index
    # Configuration object.
    options = {
      # The name of your bucket.
      bucket: 'bucket-name',

      # S3 region. If you are using the default us-east-1, it this can be ignored.
      region: 'eu-west-1',

      # The folder where to upload the images.
      keyStart: 'uploads',

      # File access.
      acl: 'public-read',

      # AWS keys.
      accessKey: 'YOUR_AWS_ACCESS_KEY',
      secretKey: 'YOUR_AWS_SECRET_KEY'
    }

    # Compute the signature.
    @aws_data = FroalaEditorSDK::S3.data_hash(options)
  end

  ...

end
class UploadController
在您的情况下,您没有创建签名,这一定是错误