> For the complete documentation index, see [llms.txt](https://talltips.novate.co.uk/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://talltips.novate.co.uk/laravel/using-s3.md).

# Using S3

See also;

{% content-ref url="/pages/-MFj4sSi7ftYHwb714Q6" %}
[Livewire File Uploads Using S3](/livewire/livewire-file-uploads-using-s3.md)
{% endcontent-ref %}

## Content in folders

Segregate your S3 content according to your environment. Adding the following to `config/filesystems.php`

```php
        'pdfs' => [
            'driver' => 's3',
            'root' => env('APP_NAME') . '/pdfs',
            'key' => env('AWS_ACCESS_KEY_ID'),
            'secret' => env('AWS_SECRET_ACCESS_KEY'),
            'region' => env('AWS_DEFAULT_REGION'),
            'bucket' => 'mybucket',
            'visibility' => 'public',

        ],
```

In the above, PDF files will be stored for public consumption within a disk prefixed with the environment name. The key to this is the `root` attribute. This provides a path to prefix to all files that are created in the pdfs disk.

Write files to the pdf folder after specifying the disk;

```php
Storage::disk('pdfs')->put('hello.txt','hello');
```

The `->url()` command can be used to get the public url for the created file;

```php
>>> Storage::disk('pdfs')->url('hello.txt');
=> "https://mybucket.s3.eu-west-1.amazonaws.com/MYAPP-DEV/pdfs/hello.txt"
```

Be sure to have different app names between Dev, Staging and Live to separate your output.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://talltips.novate.co.uk/laravel/using-s3.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
