QCloudPutObjectRequest Class Reference

Conforms to BodyType
Declared in QCloudPutObjectRequest.h
QCloudPutObjectRequest.m

Overview

简单上传的方法.

功能描述

简单上传主要适用于在单个请求中上传一个小于 5 GB 大小的对象. 对于大于 5 GB 的对象(或者在高带宽或弱网络环境中 )优先使用分片上传的方式 (https://cloud.tencent.com/document/product/436/14112)..)

关于简单上传接口的具体描述,请查看 https://cloud.tencent.com/document/product/436/7749.

示例

@code

QCloudPutObjectRequest* put = [QCloudPutObjectRequest new];

// 存储桶名称,格式为 BucketName-APPID
put.bucket = @"examplebucket-1250000000";

// 对象键,是对象在 COS 上的完整路径,如果带目录的话,格式为 "dir1/object1"
put.object = @"exampleobject";

put.body =  [@"testFileContent" dataUsingEncoding:NSUTF8StringEncoding];

[put setFinishBlock:^(id outputObject, NSError *error) {

    // outputObject 包含所有的响应 http 头部
    NSDictionary* info = (NSDictionary *) outputObject;
}];

[[QCloudCOSXMLService defaultCOSXML] PutObject:put];

  object

对象 名称

@property (strong, nonatomic) NSString *object

Declared In

QCloudPutObjectRequest.h

  bucket

存储桶 名称

@property (strong, nonatomic) NSString *bucket

Declared In

QCloudPutObjectRequest.h

  cacheControl

RFC 2616 中定义的缓存策略,将作为 Object 元数据保存

@property (strong, nonatomic) NSString *cacheControl

Declared In

QCloudPutObjectRequest.h

  contentType

RFC 2616 中定义用于指示资源的MIME类型,将作为 Object 元数据保存

@property (strong, nonatomic) NSString *contentType

Declared In

QCloudPutObjectRequest.h

  contentDisposition

RFC 2616 中定义的文件名称,将作为 Object 元数据保存

@property (strong, nonatomic) NSString *contentDisposition

Declared In

QCloudPutObjectRequest.h

  expect

当使用 Expect: 100-continue 时,在收到服务端确认后,才会发送请求内容

@property (strong, nonatomic) NSString *expect

Declared In

QCloudPutObjectRequest.h

  expires

RFC 2616 中定义的过期时间,将作为 Object 元数据保存

@property (strong, nonatomic) NSString *expires

Declared In

QCloudPutObjectRequest.h

  storageClass

对象的存储级别,枚举值:STANDARD(QCloudCOSStorageStandard),STANDARD_IA(QCloudCOSStorageStandardIA) ,ARCHIVE(QCloudCOSStorageARCHIVE)。默认值:STANDARD(QCloudCOSStorageStandard)

@property (assign, nonatomic) QCloudCOSStorageClass storageClass

Declared In

QCloudPutObjectRequest.h

  accessControlList

定义 Object 的 ACL 属性。有效值:private,public-read-write,public-read;默认值:private

@property (strong, nonatomic) NSString *accessControlList

Declared In

QCloudPutObjectRequest.h

  grantRead

赋予被授权者读的权限。格式:id=“OwnerUin”;

@property (strong, nonatomic) NSString *grantRead

Declared In

QCloudPutObjectRequest.h

  grantWrite

赋予被授权者写的权限。格式:id=“OwnerUin”;

@property (strong, nonatomic) NSString *grantWrite

Declared In

QCloudPutObjectRequest.h

  grantFullControl

赋予被授权者读写权限。格式: id=“OwnerUin”;

@property (strong, nonatomic) NSString *grantFullControl

Declared In

QCloudPutObjectRequest.h

  versionID

指定对象对应的Version ID(在开启了多版本的情况才有)

@property (strong, nonatomic) NSString *versionID

Declared In

QCloudPutObjectRequest.h