Uploading Objects to a Bucket or Folder

Upload one or more objects to a bucket in Object Storage.

Tip

If the objects are larger than 64 MiB and multipart uploads is used, you need OBJECT_CREATE and OBJECT_OVERWRITE permissions.
  • To upload objects larger than 64 MiB, the Console uses multipart uploads. For details, seeUsing Multipart Uploads and Details for Object Storage, Archive Storage, and Data Transfer.

    1. Open the navigation menu and click Storage. Under Object Storage & Archive Storage, click Buckets.
    2. Choose the compartment that contains the bucket to which you want to upload objects, and then click the name of the bucket.
    3. At the top of the Objects table, click Upload. To upload objects to a folder in the bucket, click the Actions menu (Actions Menu) to the right of the folder, and select Upload.
    4. (Optional) Specify an Object Name Prefix. If provided, this prefix is prepended to each one of the files you upload.
      • Prefix strings with a forward slash (/) delimiter to simulate hierarchy and create folders or subfolders
      • Prefix strings without a delimiter for matching purposes to perform allowed bulk operations

      For details, see Object Naming Using Prefixes and Hierarchies.

    5. (Optional) If the Storage Tier field displays Standard (the storage tier of the bucket), you can change the storage tier to upload objects to the Infrequent Access or Archive storage instead.
      Note

      Standard storage tier buckets can contain a mix of objects with different storage tier assignments. An object remains in the Standard bucket, even if the object is archived, restored, or if tier assignment is changed.
    6. Select the object or objects that you want to upload in one of two ways:
      • Drag one or more files from your computer.
      • Click the select files link to display a file selection dialog box.

      The files you select to upload are displayed in a list. If you decide that you do not want to upload a particular file, click the X to the right of the file name.

      If the files you select to upload are already stored in the bucket or folder with the same name, the Console displays messages warning you of an overwrite.

    7. To specify values for optional response headers and metadata to be displayed in Object Details, click Show Optional Response Headers and Metadata.
      1. Select the type of attribute that you are adding.
      2. To add a response header, select a value in the Name list and then enter a value in the Value box.
      3. To add metadata, enter a value in the Name box and then enter a value in the Value box.
      4. To add another attribute, click + Add More Headers or Metadata.
    8. Click Upload.

      The selected objects are uploaded and displayed in the list of objects in the bucket or folder.

  • oci os object put --namespace <object_storage_namespace> --bucket-name <bucket_name> --file <file_location> [--name <object_name>] [--storage-tier <object_storage_tier>] --no-multipart

    <file_location> is the source directory path of the object being uploaded, such as C:\workspace\Uploads\MyFile.txt or /home/user/Documents/Uploads/MyFile.txt.

    <object_name> is the name of the uploaded object excluding the path. This parameter is required if the object is being read from STDIN. If you want to use the filename as the uploaded object's name (if not being read from STDIN), omit the --name option. The resulting object name does not include the path information (for example, C:\workspace\Uploads\), just the actual file name by itself (MyFile.txt).

    For example, to upload an object using the original filename, omit the --name option:

    oci os object put --namespace MyNamespace --bucket-name MyBucket --file C:\workspace\Uploads\MyFile.txt --no-multipart
    {
    	"etag": "cadb9f8a-3292-45e6-a1e8-f075699fb619",
    	"last-modified": "Fri, 11 Dec 2020 14:04:19 GMT",
    	"opc-content-md5": "9P61OSaYe4fXxaeK8siuDw=="
    }

    If you do not specify --storage-tier, the object is automatically assigned and uploaded to the default storage tier of the bucket (Standard or Archive).

    If you are uploading to a Standard tier bucket, you can specify --storage-tier <object_storage_tier> to upload the object to a different storage tier:

    For example, to upload an object to the default storage tier of the bucket, omit --storage-tier:

    oci os object put --namespace MyNamespace --bucket-name MyStandardBucket --file C:\workspace\Uploads\MyFile.txt --name MyFile.txt --no-multipart
    {
    	"etag": "cadb9f8a-3292-45e6-a1e8-f075699fb619",
    	"last-modified": "Fri, 11 Dec 2020 14:04:19 GMT",
    	"opc-content-md5": "9P61OSaYe4fXxaeK8siuDw=="
    }

    Or:

    oci os object put --namespace MyNamespace --bucket-name MyArchiveBucket --file C:\workspace\Uploads\MyFile.txt --name MyFile.txt --no-multipart
    {
    	"etag": "cadb9f8a-3292-45e6-a1e8-f075699fb619",
    	"last-modified": "Fri, 11 Dec 2020 14:04:19 GMT",
    	"opc-content-md5": "9P61OSaYe4fXxaeK8siuDw=="
    }
    For example, to upload an object to the Infrequent Access tier, specify --storage-tier:
    oci os object put --namespace MyNamespace --bucket-name MyStandardBucket --file C:\workspace\Uploads\MyDocument.txt --storage-tier InfrequentAccess --no-multipart
    {
    	"etag": "6b292c1a-b01b-4f36-97c8-4567fb43d071",
    	"last-modified": "Sat, 12 Dec 2020 12:58:01 GMT",
    	"opc-content-md5": "9P61OSaYe4fXxaeK8siuDw=="
    }
    For example, to upload an object to the Archive tier, specify --storage-tier:
    oci os object put --namespace MyNamespace --bucket-name MyStandardBucket --file C:\workspace\Uploads\MyDocument.txt --storage-tier Archive --no-multipart
    {
    	"etag": "6b292c1a-b01b-4f36-97c8-4567fb43d071",
    	"last-modified": "Sat, 12 Dec 2020 12:58:01 GMT",
    	"opc-content-md5": "9P61OSaYe4fXxaeK8siuDw=="
    }

    An object can be uploaded as a single part or as multiple parts. Use the --no-multipart option to upload as a single part. For detailed information on multipart uploads, see Using Multipart Uploads.

    To add optional response headers, use one or more of the following options:

    1. --cache-control
    2. --content-disposition
    3. --content-encoding
    4. --content-language
    5. --content-disposition
    6. --content-type

    For more information about attributes that you can add when you upload an object, see Optional Response Headers and Metadata. For more details about these headers, see the Command Line Reference.

    For example:

    oci os object put --namespace MyNamespace --bucket-name MyBucket --file C:\workspace\MyFile --cache-control no-cache --no-multipart

    To add custom metadata key-value pairs, use the --metadata option:

    oci os object put --namespace <object_storage_namespace> --bucket-name <bucket_name> --file <file_location> --name <object_name>  --metadata <json_formatted_key-value_pairs> --no-multipart

    <JSON-formatted_key-value_pair> is a key-value pair input as valid formatted JSON. See Passing Complex Input and Using a JSON File for Complex Input for more information about JSON formatting.

    For example:

    oci os object put --namespace MyNamespace --bucket-name MyBucket --file C:\workspace\MyFile.txt --metadata '{"Department": "Finance"}' --no-multipart
    {
      "etag": "3504606b-8412-4b5d-924a-aeaeacf1df1e",
      "last-modified": "Wed, 20 Nov 2019 04:37:29 GMT",
      "opc-content-md5": "1B2M2Y8AsgTpgAmY7PhCfg=="
    }

    Bulk Uploading Objects to a Bucket

    oci os object bulk-upload --namespace <object_storage_namespace> --bucket-name <bucket_name> --src-dir <source_directory_location>

    <source_directory_location> is the upload directory path, such as C:\workspace\Upload\ or /home/user/Documents/Upload. If your source directory has subdirectories, the subdirectory names are prepended to the names of the files stored in those subdirectories, delimited with a forward slash (/) character. For example, if a file named maple.jpg is stored in the subdirectory trees, when the file is uploaded, Object Storage assigns the name trees/maple.jpg to the resulting object.

    If you are uploading to a Standard tier bucket, you can optionally specify the <object_storage_tier> to upload the object to:

    If you do not specify --storage-tier option, the object is uploaded to the default storage tier of the bucket.

    For example, to upload objects to the default storage tier of the bucket:

    oci os object bulk-upload --namespace MyNamespace --bucket-name MyBucket --src-dir C:\workspace\Files
    Uploaded logFile.log [####################################] 100%
    Uploaded MyFile.txt [####################################] 100%
    
    {
      "skipped-objects": [],
      "upload-failures": {},
      "uploaded-objects": {
        "MyFile.txt": {      
        "etag": "e25f95e6-a2bd-435c-83d6-785f838134d5",
        "last-modified": "last-modified": "Sat, 12 Dec 2020 11:31:36 GMT",
        "opc-content-md5": "opc-content-md5": "vqglL/ToD0FxnqE83wBycw=="
      },
        "logFile.log": {
        "etag": "bbcf33dd-a177-4406-bed1-a4f7125da800",
        "last-modified": "Sat, 12 Dec 2020 11:31:36 GMT",
        "opc-content-md5": "K8vB8NVASIvtL2BE5ksUjw=="
        }
      }
    }

    For example, to upload objects to the Infrequent Access storage tier:

    oci os object bulk-upload --namespace MyNamespace --bucket-name MyBucket --src-dir C:\workspace\Files --storage-tier InfrequentAccess
    Uploaded logFile.log [####################################] 100%
    Uploaded MyFile.txt [####################################] 100%
    
    {
      "skipped-objects": [],
      "upload-failures": {},
      "uploaded-objects": {
        "MyFile.txt": {      
        "etag": "e25f95e6-a2bd-435c-83d6-785f838134d5",
        "last-modified": "last-modified": "Sat, 12 Dec 2020 11:31:36 GMT",
        "opc-content-md5": "opc-content-md5": "vqglL/ToD0FxnqE83wBycw=="
      },
        "logFile.log": {
        "etag": "bbcf33dd-a177-4406-bed1-a4f7125da800",
        "last-modified": "Sat, 12 Dec 2020 11:31:36 GMT",
        "opc-content-md5": "K8vB8NVASIvtL2BE5ksUjw=="
        }
      }
    }

    For example, to upload objects to the Archive tier:

    oci os object bulk-upload --namespace MyNamespace --bucket-name MyBucket --src-dir C:\workspace\Files --storage-tier Archive
    Uploaded logFile.log [####################################] 100%
    Uploaded MyFile.txt [####################################] 100%
    
    {
      "skipped-objects": [],
      "upload-failures": {},
      "uploaded-objects": {
        "MyFile.txt": {      
        "etag": "e25f95e6-a2bd-435c-83d6-785f838134d5",
        "last-modified": "last-modified": "Sat, 12 Dec 2020 11:31:36 GMT",
        "opc-content-md5": "opc-content-md5": "vqglL/ToD0FxnqE83wBycw=="
      },
        "logFile.log": {
        "etag": "bbcf33dd-a177-4406-bed1-a4f7125da800",
        "last-modified": "Sat, 12 Dec 2020 11:31:36 GMT",
        "opc-content-md5": "K8vB8NVASIvtL2BE5ksUjw=="
        }
      }
    }

    To append a prefix string to the object names created by your uploads, use the --object-prefix option. For example:

    oci os object bulk-upload --namespace MyNamespace --bucket-name MyBucket --src-dir C:\workspace\Files --object-prefix /bicycling/gloves/
    				
    Uploaded /bicycling/gloves/gloves_27_A.jpg [####################################] 100%
    Uploaded /bicycling/gloves/gloves_31_A.jpg [####################################] 100%
    
    {
      "skipped-objects": [],
      "upload-failures": {},
      "uploaded-objects": {
        "/bicycling/gloves/gloves_27_A.jpg": {
          "etag": "7ba793ce-a341-4c56-9baf-61ca2c56ad50",
          "last-modified": "Sat, 12 Dec 2020 18:35:09 GMT",
          "opc-content-md5": "1B2M2Y8AsgTpgAmY7PhCfg=="
      },
        "/bicycling/gloves/gloves_31_A.jpg": {
          "etag": "6efa58a6-a723-4696-a31f-3c5099adbec4",
          "last-modified": "Sat, 12 Dec 2020 18:35:09 GMT",
          "opc-content-md5": "6GxlLP9fa71HhVnpLNJ+DQ=="
        }
      }
    }

    To add custom metadata key-value pairs, use the --metadata <JSON_formatted_key-value_pairs> option.

    <JSON-formatted_key-value_pair> is a key-value pair input as valid formatted JSON. See Passing Complex Input and Using a JSON File for Complex Input for information about JSON formatting.

  • This task is not available in the API.