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:
1
let image1: UIImage = AN_IMAGE
2
let image2: UIImage = ANOTHER_IMAGE
3
4
// Upload a single image
5
MBAdmin.uploadMediaImage(image: image1,
6
name: "Image name",
7
success: { media in
8
9
}, failure: { error in
10
11
})
12
13
// Upload multiple images
14
MBAdmin.uploadMediaImages(images: [image1, image2],
15
names: ["Image1", "Image2"],
16
success: { media in
17
18
}, failure: { error in
19
20
})
Copied!
To upload files with their URLs:
1
let file1Url: URL = AN_URL
2
let file2Url: URL = ANOTHER_URL
3
4
// Upload a single file
5
MBAdmin.uploadMedia(media: file1Url,
6
success: { media in
7
8
},
9
failure: { error in
10
11
})
12
13
// Upload an array of files
14
MBAdmin.uploadMedia(media: [file1Url, file2Url],
15
success: { media in
16
17
},
18
failure: { error in
19
20
})
Copied!
Last modified 10mo ago
Copy link