After you upload objects to a bucket, you can share the URLs of the objects with third parties for downloads or previews. 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 that corresponds to the object you want to share.
  4. In the View Details panel, click Copy File URL.
    If the access control list (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 is previewed but not downloaded when third parties use the object URL that you share to access the object, you must map a custom domain name to your bucket and add a CNAME record. For more information, see Use a custom domain name to access OSS resources.

    • Download an object by using the object URL

      To ensure that the object is downloaded when third parties use the object URL that you share to access the object, you must set the Content-Disposition field in the HTTP headers of the object to attachment. For more information, see Configure object metadata.

Other implementation methods

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