AccessDenied Invalid according to Policy: Extra input fields: content-type
当我有这个
------WebKitFormBoundaryZIsnhgiAKpAVIsBT
Content-Disposition: form-data; name="acl"
public-read
------WebKitFormBoundaryZIsnhgiAKpAVIsBT
Content-Disposition: form-data; name="awsaccesskeyid"
my-access-key-id
------WebKitFormBoundaryZIsnhgiAKpAVIsBT
Content-Disposition: form-data; name="bucket"
my-bucket
------WebKitFormBoundaryZIsnhgiAKpAVIsBT
Content-Disposition: form-data; name="Content-Type"
image/png
------WebKitFormBoundaryZIsnhgiAKpAVIsBT
Content-Disposition: form-data; name="key"
images/anime_girl.png
------WebKitFormBoundaryZIsnhgiAKpAVIsBT
Content-Disposition: form-data; name="policy"
my-policy
------WebKitFormBoundaryZIsnhgiAKpAVIsBT
Content-Disposition: form-data; name="signature"
my-signature
------WebKitFormBoundaryZIsnhgiAKpAVIsBT
Content-Disposition: form-data; name="success_action_status"
201
------WebKitFormBoundaryZIsnhgiAKpAVIsBT
Content-Disposition: form-data; name="file"; filename="anime_girl.png"
Content-Type: image/png
Run Code Online (Sandbox Code Playgroud)
但是,如果我Content Type在下面的代码中完全省略了该文件,则会上传该文件但没有正确的内容类型.
"acl" => "public-read",
"awsaccesskeyid" => $s3->getAwsAccessKeyId(),
"bucket" => $s3->getBucket(),
"Content-Type" => $inputs['type'],
"key" => "images/" . $inputs['name'],
"policy" => …Run Code Online (Sandbox Code Playgroud) "users_voted" : [
{
"user_id" : "AQG8ECLdBRJ4jwPMG",
"score" : "down"
}
]
Run Code Online (Sandbox Code Playgroud)
想知道我将如何更新users_voted作为数组对象的字段.我需要更新一个特定的对象.我知道index这个对象所在的位置,我只需要弄清楚如何在MongoDB/Meteor集合中更新该对象.
这是一些伪代码,我必须更好地解释我的意思.
Posts.update({_id: post_id}, {$set: {vote_score[index]: u_object}});
所以在这个查询中我知道index,post_id同时也是u_object我试图放入数组的对象,而不是那里的任何对象index.如果有人可以帮我告诉我应该怎么做,那就太好了.
在Meteor更新到0.8.0后,我遇到了铁路由器的一些问题,但我能够通过添加blade-layout包并更新来修复它们iron-router...
但是,现在我在浏览器控制台中收到以下错误(正常控制台不会丢失任何错误,只是告诉我应用程序在localhost:3000运行).
当我尝试访问主页时,这是我在浏览器控制台中遇到的错误.这只是在我更新到Meteor 0.8.0之后才开始发生的
Exception in defer callback: Error: Can't call non-function: [object Object]
at Spacebars.call (http://localhost:3000/packages/spacebars.js?5d478ab1c940b6f5a88f78b8adc81a47f022da77:176:13)
at Spacebars.mustacheImpl (http://localhost:3000/packages/spacebars.js?5d478ab1c940b6f5a88f78b8adc81a47f022da77:110:25)
at Object.Spacebars.mustache (http://localhost:3000/packages/spacebars.js?5d478ab1c940b6f5a88f78b8adc81a47f022da77:114:39)
at Template.__define__.HTML.DIV.class (http://localhost:3000/client/html/template.page_layout.js?b9f71b600d93464d684baf69d25d5f1c78c77785:6:22)
at http://localhost:3000/packages/ui.js?b523ef986d3d39671bcb40319d0df8982acacfe8:2299:21
at callWithNoYieldsAllowed (http://localhost:3000/packages/deps.js?7afb832ce6e6c89421fa70dc066201f16f9b9105:74:5)
at _.extend._compute (http://localhost:3000/packages/deps.js?7afb832ce6e6c89421fa70dc066201f16f9b9105:212:7)
at new Deps.Computation (http://localhost:3000/packages/deps.js?7afb832ce6e6c89421fa70dc066201f16f9b9105:144:10)
at Object._.extend.autorun (http://localhost:3000/packages/deps.js?7afb832ce6e6c89421fa70dc066201f16f9b9105:361:13)
at materialize (http://localhost:3000/packages/ui.js?b523ef986d3d39671bcb40319d0df8982acacfe8:2298:29) debug.js:41
Run Code Online (Sandbox Code Playgroud)
如果其他人遇到此错误,请通过可能的解决方案让我知道这意味着什么.
我很感激帮助.
如何在Meteor中指定内容类型?
我有一个页面返回JSON但响应头是html/text我需要做的application/json.我正在使用iron-router然后通过模板显示json.我只需要更改该页面的响应头.
我该怎么做?
WordPress的wp_postmeta表有一个帖子的所有附加字段,但它们是行,所以很容易添加更多.
但是,现在我想查询所有帖子的所有字段,我明显希望列中的那些字段而不是一行.
这是我正在运行的查询
SELECT p.post_title,
m.meta_value,
m.meta_key
FROM wp_posts p
JOIN wp_postmeta m
ON p.id = m.post_id
WHERE p.id = 72697;
Run Code Online (Sandbox Code Playgroud)
这将为我提供所有meta_values及其各自的元键作为列.但我需要将元键值作为列,将元值作为行
例如,a meta_key可能是additional_description,它的价值可能是What's up
所以我需要这样的东西
SELECT p.post_title, additional_description
FROM wp_posts p
JOIN wp_postmeta m
ON p.id = m.post_id
WHERE p.id = 72697;
Run Code Online (Sandbox Code Playgroud)
我需要它作为专栏.我还需要所有的帖子,而不是特定的帖子,但每当我删除where它只是不查询(我有很多帖子,这可能是一个问题).
这是一些示例数据以及我希望结果如何显示wp_postmeta表
meta_key post_id meta_key meta_value
1 5 total_related 5
2 5 updated 0
3 5 cricket 1
4 8 total_related 8
5 8 updated 1
6 8 cricket …Run Code Online (Sandbox Code Playgroud) 我正在创建一个 REST API,并且我已经将每个资源分离到它自己的包中。我有一个User和一个Group包裹。两种资源之间存在多对多关系。所以我需要User导入Group,并Group导入到User。由于两个结构都需要它们作为字段。
我的问题是,我是否应该创建另一个包并导入这两个包,然后将该包导入到每个包中?
还是在 go lang 中将这两个包合二为一更有意义?
我已经看到以下问题正则表达式删除一个特定的重复字符,这个字符与我的非常相似(如果不准确),但它是用C#实现的,并使用该语言的字符串方法.
我想知道是否有人可以提出javascript它的实施?
如果你有例子
what---is-your-name- => what-is-your-name
---what-is----your-name-- => what-is-your-name
Run Code Online (Sandbox Code Playgroud)
那么如何删除特定字符的重现,在这种情况下-,用-javascript中的一个替换它?