根据策略策略条件无效启动失败 - 使用$ content-type“”

时间:2013-12-11 16:56:37

标签: policy fine-uploader

我正在尝试使用fineuploader 3.8.2在Sony Xperia Tipo或HTC Evo 3d上使用android 4.0上传照片并面临一个奇怪的问题。在通过相机工作上传时,通过图库上传不起作用并给予我 根据策略策略条件无效启动 - 使用$ content-type“”错误

$('#fineuploader-s3').fineUploaderS3({
        request: {
            endpoint: "http://mybucket.s3.amazonaws.com",
            accessKey: "MYACCESSKEY"
        },

        signature: {
            endpoint: "myendpoint",
        },

        objectProperties: {
            acl: 'public-read',
            key: =>
                uploaded_image_key = qq.getUniqueId()
                return "#{uploaded_image_key}.png"
        },

        iframeSupport: {
            localBlankPagePath: "/myiframe.html"
        },

        text: {
            uploadButton: '<div><i class="icon-upload"></i>&nbsp;Upload Image</div>'
        },

        uploadSuccess:{
            endpoint: null
        },

        template: 'mytemplate',

        camera: {
            ios: true
        },

        multiple: false,

        retry: {
            showButton: true
        },

        validation: {
            allowedExtensions: ["gif", "jpeg", "jpg", "png"],
            acceptFiles: "image/gif, image/jpeg, image/png"
        },

        chunking: {
            enabled: true
        },

        resume: {
            enabled: true
        }
    }).on('complete', (event, id, fileName, responseJSON) =>
            if responseJSON.success
                $(@el).find('#thumb_pics').append("<img class='thumb' src ='http://s3.amazonaws.com/mybucket/#{uploaded_image_key}.png' title = '#{fileName}' />")
                $('#submit_feedpost').prop('disabled', false)
        ).on('error', (event, id, fileName, errorReason, xhr) =>
            $('#submit_feedpost').prop('disabled', false)
                            alert(errorReason)
        )

我的政策是这样的 -

'{
"expiration": "myexpirationdate",
"conditions":[
    {"bucket": "mybucket"},
    ["starts-with", "$key" , ""],
    {"acl": "public-read"},
    {"success_action_status": "200"}, 
    ["starts-with", "$Content-Type", ""],
    ["starts-with", "$x-amz-meta-qqfilename", ""]
    ]
}'

我的CORS是这样的 -

<CORSRule>
    <AllowedOrigin>*</AllowedOrigin>
    <AllowedMethod>GET</AllowedMethod>
    <AllowedMethod>POST</AllowedMethod>
    <AllowedMethod>PUT</AllowedMethod>
    <AllowedHeader>*</AllowedHeader>
</CORSRule>

1 个答案:

答案 0 :(得分:3)

很抱歉打扰你。我发现了这个问题。我使用自己的策略对其进行签名,而不是通过fineuploader库将post请求中发送的策略签名到我的端点。无论如何,非常感谢