Uploading files
OneEntry CMS offers the ability to upload and store files of any type.
Kotlin Multiplatform
File Upload
By executing this code, you send a file to the CMS. As a result, you will receive information about the upload, including the new filename in the system.
val storage = StorageService.upload(
id = 3787,
type = "page",
entity = "entity",
files = {
add("./resources/image_1.png")
add("./resources/image_2.png")
add("./resources/image_3.png")
}
)
View the Content of the Uploaded File
After uploading a file to the CMS, you can retrieve its content by executing the following code:
val bytes = StorageService.content(
filename = "image_1.png",
id = 3787,
type = "page",
entity = "entity"
)
Deleting a File
If a file has become obsolete, you can delete it.
StorageService.delete(
filename = "image_1.png",
id = 3787,
type = "page",
entity = "entity"
)
Swift
File Upload
By executing this code, you send a file to the CMS. As a result, you will receive information about the upload, including the new filename in the system.
let storage = try await StorageService.shared.upload(
id: 3787,
type: "page",
entity: "entity",
files: {
File("./resources/image_1.png")
File("./resources/image_2.png")
File("./resources/image_3.png")
}
)
View the Content of the Uploaded File
After uploading a file to the CMS, you can retrieve its content by executing the following code:
let data = try await StorageService.shared.content(
filename: "image_1.png",
id: 3787,
type: "page",
entity: "entity"
)
Deleting a File
If a file has become obsolete, you can delete it.
try await StorageService.shared.delete(
filename: "image_1.png",
id: 3787,
type: "page",
entity: "entity"
)
Last modified: 18 February 2025