Method: COS::API#upload
- Defined in:
- lib/cos/api.rb
#upload(path, file_name, file_src, options = {}) ⇒ Object
上传文件(完整上传)
68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/cos/api.rb', line 68 def upload(path, file_name, file_src, = {}) bucket = config.get_bucket([:bucket]) sign = http.signature.multiple(bucket) resource_path = Util.get_resource_path(config.app_id, bucket, path, file_name) payload = { op: 'upload', sha: Util.file_sha1(file_src), filecontent: File.new(file_src, 'rb'), biz_attr: [:biz_attr] } http.post(resource_path, {}, sign, payload) end |