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 Object Storage Service (OSS) console.
Prerequisites
Objects are uploaded to the bucket. For more information, see Upload objects.Procedure
Log on to the OSS console.
In the left-side navigation pane, click Buckets. On the Buckets page, find and click the desired bucket.
In the left-side navigation tree, choose Files > Objects.
- On the Objects page, click the name of an object that you want to share or click View Details in the Actions column.
- 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 during which the URL is valid. The default validity period of a URL is 3,600 seconds (1 hour). The maximum validity period is 32,400 seconds (9 hours). To obtain a URL with a longer validity period, we recommend that you use ossutil, ossbrowser, or OSS SDKs.Warning Check whether the data that you want to share contains sensitive content to prevent data leakage.
- 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 custom domain names to access OSS resources in the OSS console.
- 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.
- Preview an object by using the object URL