Vue+AmazonS3上传文件功能

话不多说,直接上代码。

如果上传失败,报此错误:ETagMissing No access to ETag property on response. Check CORS configuration to expose ETag header.

解决方案:找到配置的存储桶——权限——跨源资源共享(CORS),配置如下

[{

        "AllowedHeaders": [

            "*"

        ],

        "AllowedMethods": [

            "GET",

            "PUT",

            "POST",

            "DELETE"

        ],

        "AllowedOrigins": [

            "可以输入你当前上传功能所在的域名地址,如www.baidu.com"

        ],

        "ExposeHeaders": [

            "ETag",

            "x-amz-meta-custom-header"

        ]

    }]

上传完成!

你可能感兴趣的:(Vue+AmazonS3上传文件功能)