# Upload media

You can upload media in 2 ways:

* Uploading images, giving them names. In that case images will be converted in `jpg` (you can specify the compression quality).
* Uploading files with their URL.

To upload an image or multiple images:

```swift
let image1: UIImage = AN_IMAGE
let image2: UIImage = ANOTHER_IMAGE

// Upload a single image        
MBAdmin.uploadMediaImage(image: image1,
                         name: "Image name",
                         success: { media in

}, failure: { error in

})

// Upload multiple images
MBAdmin.uploadMediaImages(images: [image1, image2],
                          names: ["Image1", "Image2"],
                          success: { media in

}, failure: { error in

})
```

To upload files with their URLs:

```swift
let file1Url: URL = AN_URL
let file2Url: URL = ANOTHER_URL

// Upload a single file
MBAdmin.uploadMedia(media: file1Url,
                    success: { media in

                    },
                    failure: { error in

                    })

// Upload an array of files
MBAdmin.uploadMedia(media: [file1Url, file2Url],
                    success: { media in

                    },
                    failure: { error in

                    })
```


---

# 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://docs.mburger.cloud/ios-docs/admin/upload-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.
