The customer-supplied encryption key to use for this operation. If this property is null, the EncryptionKey
will be used instead. Use None to remove encryption headers from this request.
Currently, either customer-supplied encryption or a Cloud KMS key can be used, but not both.
If this property is null and customer-supplied encryption is not being used,
the bucket encryption defaults will be used to determine the encryption for the object.
If this property is non-null and the client object has a default encryption key, the EncryptionKey property
of this options object must be set to None to make the intention clear.
The hash is only validated at the end of the upload, after the object has been created.
An exception is thrown if it's incorrect, but the object will still exist unless
the validation action deletes it.
UserProject
public string UserProject { get; set; }
If set, this is the ID of the project which will be billed for the request.
The caller must have suitable permissions for the project being billed.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["\u003cp\u003eThe \u003ccode\u003eUploadObjectOptions\u003c/code\u003e class in the Google Cloud Storage v1 API provides configuration options for uploading objects.\u003c/p\u003e\n"],["\u003cp\u003eThe latest version of the \u003ccode\u003eUploadObjectOptions\u003c/code\u003e documentation is 4.11.0, but you can find documentation for versions ranging from 3.4.0 to 4.10.0 as well.\u003c/p\u003e\n"],["\u003cp\u003eKey properties within \u003ccode\u003eUploadObjectOptions\u003c/code\u003e include \u003ccode\u003eChunkSize\u003c/code\u003e, \u003ccode\u003eEncryptionKey\u003c/code\u003e, \u003ccode\u003eKmsKeyName\u003c/code\u003e, and various precondition settings like \u003ccode\u003eIfGenerationMatch\u003c/code\u003e and \u003ccode\u003eIfMetagenerationNotMatch\u003c/code\u003e to manage object uploads.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eMinimumChunkSize\u003c/code\u003e field is a constant set to 262144, and any set chunk size must be a positive multiple of this value.\u003c/p\u003e\n"],["\u003cp\u003eUpload validation for data integrity is controlled by the \u003ccode\u003eUploadValidationMode\u003c/code\u003e property.\u003c/p\u003e\n"]]],[],null,["# Google Cloud Storage v1 API - Class UploadObjectOptions (4.13.0)\n\nVersion latestkeyboard_arrow_down\n\n- [4.13.0 (latest)](/dotnet/docs/reference/Google.Cloud.Storage.V1/latest/Google.Cloud.Storage.V1.UploadObjectOptions)\n- [4.11.0](/dotnet/docs/reference/Google.Cloud.Storage.V1/4.11.0/Google.Cloud.Storage.V1.UploadObjectOptions)\n- [4.10.0](/dotnet/docs/reference/Google.Cloud.Storage.V1/4.10.0/Google.Cloud.Storage.V1.UploadObjectOptions)\n- [4.9.0](/dotnet/docs/reference/Google.Cloud.Storage.V1/4.9.0/Google.Cloud.Storage.V1.UploadObjectOptions)\n- [4.8.0](/dotnet/docs/reference/Google.Cloud.Storage.V1/4.8.0/Google.Cloud.Storage.V1.UploadObjectOptions)\n- [4.7.0](/dotnet/docs/reference/Google.Cloud.Storage.V1/4.7.0/Google.Cloud.Storage.V1.UploadObjectOptions)\n- [4.6.0](/dotnet/docs/reference/Google.Cloud.Storage.V1/4.6.0/Google.Cloud.Storage.V1.UploadObjectOptions)\n- [4.5.0](/dotnet/docs/reference/Google.Cloud.Storage.V1/4.5.0/Google.Cloud.Storage.V1.UploadObjectOptions)\n- [4.4.0](/dotnet/docs/reference/Google.Cloud.Storage.V1/4.4.0/Google.Cloud.Storage.V1.UploadObjectOptions)\n- [4.3.0](/dotnet/docs/reference/Google.Cloud.Storage.V1/4.3.0/Google.Cloud.Storage.V1.UploadObjectOptions)\n- [4.2.0](/dotnet/docs/reference/Google.Cloud.Storage.V1/4.2.0/Google.Cloud.Storage.V1.UploadObjectOptions)\n- [4.1.0](/dotnet/docs/reference/Google.Cloud.Storage.V1/4.1.0/Google.Cloud.Storage.V1.UploadObjectOptions)\n- [4.0.0](/dotnet/docs/reference/Google.Cloud.Storage.V1/4.0.0/Google.Cloud.Storage.V1.UploadObjectOptions)\n- [3.7.0](/dotnet/docs/reference/Google.Cloud.Storage.V1/3.7.0/Google.Cloud.Storage.V1.UploadObjectOptions)\n- [3.6.0](/dotnet/docs/reference/Google.Cloud.Storage.V1/3.6.0/Google.Cloud.Storage.V1.UploadObjectOptions)\n- [3.5.0](/dotnet/docs/reference/Google.Cloud.Storage.V1/3.5.0/Google.Cloud.Storage.V1.UploadObjectOptions)\n- [3.4.0](/dotnet/docs/reference/Google.Cloud.Storage.V1/3.4.0/Google.Cloud.Storage.V1.UploadObjectOptions) \n\n public sealed class UploadObjectOptions\n\nReference documentation and code samples for the Google Cloud Storage v1 API class UploadObjectOptions.\n\nOptions for `UploadObject` operations. \n\nInheritance\n-----------\n\n[object](https://learn.microsoft.com/dotnet/api/system.object) \\\u003e UploadObjectOptions \n\nInherited Members\n-----------------\n\n[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) \n[object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) \n[object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)\n\nNamespace\n---------\n\n[Google.Cloud.Storage.V1](/dotnet/docs/reference/Google.Cloud.Storage.V1/latest/Google.Cloud.Storage.V1)\n\nAssembly\n--------\n\nGoogle.Cloud.Storage.V1.dll\n\nFields\n------\n\n### MinimumChunkSize\n\n public const int MinimumChunkSize = 262144\n\nThe minimum chunk size for uploading.\n\nProperties\n----------\n\n### ChunkSize\n\n public int? ChunkSize { get; set; }\n\nThe chunk size to use for each request. When setting to a non-null value, this\nmust be a positive multiple of [MinimumChunkSize](/dotnet/docs/reference/Google.Cloud.Storage.V1/latest/Google.Cloud.Storage.V1.UploadObjectOptions#Google_Cloud_Storage_V1_UploadObjectOptions_MinimumChunkSize).\n\n### EncryptionKey\n\n public EncryptionKey EncryptionKey { get; set; }\n\nThe customer-supplied encryption key to use for this operation. If this property is null, the [EncryptionKey](/dotnet/docs/reference/Google.Cloud.Storage.V1/latest/Google.Cloud.Storage.V1.StorageClient#Google_Cloud_Storage_V1_StorageClient_EncryptionKey)\nwill be used instead. Use [None](/dotnet/docs/reference/Google.Cloud.Storage.V1/latest/Google.Cloud.Storage.V1.EncryptionKey#Google_Cloud_Storage_V1_EncryptionKey_None) to remove encryption headers from this request.\n\n### IfGenerationMatch\n\n public long? IfGenerationMatch { get; set; }\n\nPrecondition for upload: the object is only uploaded if the existing object's\ngeneration matches the given value.\n\n### IfGenerationNotMatch\n\n public long? IfGenerationNotMatch { get; set; }\n\nPrecondition for upload: the object is only uploaded if the existing object's\ngeneration does not match the given value.\n\n### IfMetagenerationMatch\n\n public long? IfMetagenerationMatch { get; set; }\n\nPrecondition for upload: the object is only uploaded if the existing object's\nmeta-generation matches the given value.\n\n### IfMetagenerationNotMatch\n\n public long? IfMetagenerationNotMatch { get; set; }\n\nPrecondition for upload: the object is only uploaded if the existing object's\nmeta-generation does not match the given value.\n\n### KmsKeyName\n\n public string KmsKeyName { get; set; }\n\nThe name of the Cloud KMS key to use to encrypt the object.\n\n**Remarks** \nCurrently, either customer-supplied encryption or a Cloud KMS key can be used, but not both.\nIf this property is null and customer-supplied encryption is not being used,\nthe bucket encryption defaults will be used to determine the encryption for the object.\nIf this property is non-null and the client object has a default encryption key, the [EncryptionKey](/dotnet/docs/reference/Google.Cloud.Storage.V1/latest/Google.Cloud.Storage.V1.UploadObjectOptions#Google_Cloud_Storage_V1_UploadObjectOptions_EncryptionKey) property\nof this options object must be set to [None](/dotnet/docs/reference/Google.Cloud.Storage.V1/latest/Google.Cloud.Storage.V1.EncryptionKey#Google_Cloud_Storage_V1_EncryptionKey_None) to make the intention clear.\n\n### Origin\n\n public string Origin { get; set; }\n\nIf set, an Origin header is included when initiating the resumable upload. This allows for Cross-Origin\nResource Sharing, as documented at \u003chttps://cloud.google.com/storage/docs/cross-origin\u003e.\n\n### PredefinedAcl\n\n public PredefinedObjectAcl? PredefinedAcl { get; set; }\n\nA pre-defined ACL for simple access control scenarios.\n\n### Projection\n\n public Projection? Projection { get; set; }\n\nThe projection of the uploaded object to retrieve.\n\n### UploadValidationMode\n\n public UploadValidationMode? UploadValidationMode { get; set; }\n\nSpecifies how the upload should be validated for data integrity.\nIf this property is null, this is equivalent to [DeleteAndThrow](/dotnet/docs/reference/Google.Cloud.Storage.V1/latest/Google.Cloud.Storage.V1.UploadValidationMode#Google_Cloud_Storage_V1_UploadValidationMode_DeleteAndThrow).\n\n**Remarks** \nThe hash is only validated at the end of the upload, after the object has been created.\nAn exception is thrown if it's incorrect, but the object will still exist unless\nthe validation action deletes it.\n\n### UserProject\n\n public string UserProject { get; set; }\n\nIf set, this is the ID of the project which will be billed for the request.\nThe caller must have suitable permissions for the project being billed."]]