# Exercise 6.1 - Uploading and using media

In this exercise you will upload an image directly to the media library (Part 1) and then use that image when creating content (Part 2).

## Part 1: Upload media file

1. Navigate to the *Media* page by clicking on **Content** then **Media** on the *Admin menu*.
2. Click the **Add Media** button at the top left of the page.

   <figure><img src="/files/VicowhBw5jsGqUbUfeqv" alt=""><figcaption><p>Showing Add Media button</p></figcaption></figure>
3. Click **Image** to upload an image file.

   <figure><img src="/files/8j9G5Ga0mh1mkqBD1kSF" alt=""><figcaption></figcaption></figure>
4. Upload an image file:
   1. Give it a short, descriptive name.
   2. Choose a file from your computer, using the **Browse** button.
   3. Click **Open** to upload the file.
5. Add *Alt text*.

   **Note** Image alt text is required to enable screen readers and facilitate vision-impaired people.
6. Click **Save**

   <figure><img src="/files/EuNF1qrkgUQyNuPsKmrK" alt=""><figcaption><p>Uploading an image</p></figcaption></figure>

## Part 2: Add media to a Page

1. Create a new Page following the instructions in [**Exercise 3.1**](/govcms-content-administration/unit-3-managing-content-in-govcms/creating-content/exercise-3-1-create-some-content.md)
2. Click on Banner and then expand "Banner featured image". There you will see an *Add media* button. \
   Note - you may not have a "Banner" tab if you are not using CivicTheme. In that case, find any Media upload field and use that.<br>

   <figure><img src="/files/wYbN8zJcpfnst8FC920D" alt=""><figcaption><p>Add media button</p></figcaption></figure>
3. Select the image and then click on *Insert selected*.

   <figure><img src="/files/oZ0ngc3i99ksa9tZ1ilv" alt=""><figcaption><p>Select image and click on Insert selected</p></figcaption></figure>
4. Once the image is selected you will see a preview in your content like the this screenshot:<br>

   <figure><img src="/files/iyfNMvB6PQuTNNpNYg6I" alt=""><figcaption><p>Preview of image</p></figcaption></figure>
5. Fill out any required fields for your *Page* and click the **Save.** The image now appears on the frontend. The location of the image may be different on your site depending on your theme.<br>

   <figure><img src="/files/Z0wBr3lhfrxb4Nslxvuj" alt=""><figcaption><p>Frontend of newly uploaded image</p></figcaption></figure>
6. Navigate to **Content** → **Files** from the *Admin menu* and locate the image file you uploaded. It should be at the top of the list as it is the most recently added file. Note the name of the file.

   <figure><img src="/files/4BN3b5kknhVtA3LH4gsr" alt=""><figcaption><p>Recently uploaded image in File tab</p></figcaption></figure>
7. Next, click on the **Media** tab button and locate the Media entity that that points to the file you uploaded.

   <figure><img src="/files/sa7hgEyxNRVCp9KXa1YE" alt=""><figcaption><p>Recently uplaoded media entity</p></figcaption></figure>
8. Discuss with the trainer, why the *Name* of the file (from the *Files* tab) is different to the *Media name* (from the *Media* tab).

**Tip**: The *Media* entity allows you to enter a more user-friendly *Name* (and other metadata) rather than using the name of the file.


---

# Agent Instructions: 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://salsa-digital.gitbook.io/govcms-content-administration/unit-6-files-media-assets/media-library/exercise-6-1-uploading-and-using-media.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.
