-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
支持生成上传url #7
base: master
Are you sure you want to change the base?
支持生成上传url #7
Conversation
payload = { | ||
policy: policy(base_opts.merge(opts)), | ||
signature: signature, | ||
url: "#{base_opts['save-key']}", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cgg5207 请问这个 url
字段在哪里使用到了?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/upyun/ruby-sdk/pull/7/files#diff-04c6e90faac2675aa89e2176d2eec7d8R307
file_key 就是url, 只是为了与你们返回格式统一用。
POST https://v0.api.upyun.com/prepsmith
code: 200
message: "ok"
sign: "4cfa73b094e21f17534ef8b496719af1"
time: 1449827023
url: "6965706-19a16b00-4455-4a60-854f-38a5fdcb9449"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里上面用的是 merge
方法,而不是 merge!
,所以 save-key
可能被 opts
给覆盖了.
@cgg5207 表单 API 上传支持,这是 UPYUN 服务端的特性,sdk 里面不需要额外的工作
可能我没有理解你真正的需求,麻烦请描述详细点 |
https://github.com/upyun/ruby-sdk/pull/7/files#diff-04c6e90faac2675aa89e2176d2eec7d8R317 客户直接在浏览器(chrome)上传文件到 UPYUN上,而不是先传到ruby webserver 然后再从ruby webserver上传到UPYUN,就是为了解决这个问题。 那么问题来了,不想把form-api-secret暴露在JS端上! |
|
@cgg5207 sorry 这么晚才回复你,细看了一下你的回复,你是想直接在页面上生成一个文件上传到 UPYUN 的表单tag,这个 tag 里已经包含了经过 MD5 加密的 |
是的!这个意思。 |
@cgg5207 谢谢您的反馈,稍后我将加上去(代码+测试+demo) |
nice |
客户端可以直接上传文件到upyun(而不先上传自己的主机再传到upyun)。
http://docs.upyun.com/api/form_api/