After you upload objects to a bucket, you can share the URLs of the objects with third parties for download or preview. This topic describes how to share an object in the OSS console.

Procedure

  1. Log on to the OSS console.
  2. In the left-side navigation pane, click Buckets. On the Buckets page, click the name of the bucket in which the object you want to share is stored.
  3. In the left-side navigation pane, click Files. Then, click the name of the object that you want to share, or click View Details in the Actions column corresponding to the object that you want to share.
  4. In the View Details panel, click Copy File URL.
    If the ACL of the object that you want to share is private, you must configure Validity Period (Seconds) during which the URL is valid. The default validity period of a URL is 3,600 seconds (one hour). The maximum validity period is 32,400 seconds (nine hours). To obtain a URL with a longer validity period, we recommend that you use ossutil, ossbrowser, or OSS SDKs.
    • Preview an object by using the object URL

      To ensure that the object URL you share with third parties is used to preview the object, you must bind a custom domain name to your bucket and add a CNAME record. For more information, see Use custom domain names to access OSS resources.

    • Download an object by using the object URL

      To ensure that the object URL you share with third parties is used to download the object, you must set the Content-Disposition field in the HTTP headers of the object to attachment. For more information, see Configure object HTTP headers.

Other implementation methods

Operation Implementation method
Share objects API operations
Java SDK
Python SDK
PHP SDK
Go SDK
C++ SDK
C SDK
Node.js SDK
Browser.js SDK