aboutsummaryrefslogtreecommitdiff
path: root/kvision-modules
diff options
context:
space:
mode:
Diffstat (limited to 'kvision-modules')
-rw-r--r--kvision-modules/kvision-bootstrap-upload/src/main/kotlin/pl/treksoft/kvision/form/upload/UploadInput.kt14
1 files changed, 9 insertions, 5 deletions
diff --git a/kvision-modules/kvision-bootstrap-upload/src/main/kotlin/pl/treksoft/kvision/form/upload/UploadInput.kt b/kvision-modules/kvision-bootstrap-upload/src/main/kotlin/pl/treksoft/kvision/form/upload/UploadInput.kt
index da05b04c..20859ad7 100644
--- a/kvision-modules/kvision-bootstrap-upload/src/main/kotlin/pl/treksoft/kvision/form/upload/UploadInput.kt
+++ b/kvision-modules/kvision-bootstrap-upload/src/main/kotlin/pl/treksoft/kvision/form/upload/UploadInput.kt
@@ -264,11 +264,15 @@ open class UploadInput(uploadUrl: String? = null, multiple: Boolean = false, cla
private fun getFiles(): List<KFile> {
nativeFiles.clear()
- return (getElementJQueryD()?.fileinput("getFileStack") as? Array<File>)?.toList()?.map {
- val kFile = KFile(it.name, it.size, null)
- nativeFiles[kFile] = it
- kFile
- } ?: listOf()
+ val fileStack = getElementJQueryD()?.fileinput("getFileStack")
+ val list = mutableListOf<KFile>()
+ for (key in js("Object").keys(fileStack)) {
+ val nativeFile = fileStack[key].file as File
+ val kFile = KFile(nativeFile.name, nativeFile.size, null)
+ nativeFiles[kFile] = nativeFile
+ list += kFile
+ }
+ return list
}
/**