> ## Documentation Index
> Fetch the complete documentation index at: https://docs.forest.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Generate signed urls to display S3 files in a smart field

**Context**: As a user I want to be able to preview files from an S3 bucket thanks to secure signed urls.

<img src="https://mintcdn.com/forest/UDnqA5TqR2qMKTU8/images/legacy/javascript-agents/image%20(536).png?fit=max&auto=format&n=UDnqA5TqR2qMKTU8&q=85&s=0cc47f16e470be879373b4a952b620e1" alt="" width="2000" height="1063" data-path="images/legacy/javascript-agents/image (536).png" />

**Example**: I have a collection `places` that has a `pictures` field which is an array of strings containing the file name of files stored on a s3 bucket.

In a smart field called `s3pictures` I return the value of calls made to S3 to get signed urls for the files whose name is present in the `pictures` field.

### Implementation

First you need to implement the function to get the signed urls from s3. We use the `aws-sdk` npm package to connect to the bucket storing the pictures.

`services/s3-helper.js`

You can then use the default file viewer widget settings to preview the pictures.
