diff options
-rw-r--r-- | kvision-modules/kvision-upload/src/main/kotlin/pl/treksoft/kvision/form/upload/UploadInput.kt | 6 | ||||
-rw-r--r-- | src/main/kotlin/pl/treksoft/kvision/form/FormControl.kt | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/kvision-modules/kvision-upload/src/main/kotlin/pl/treksoft/kvision/form/upload/UploadInput.kt b/kvision-modules/kvision-upload/src/main/kotlin/pl/treksoft/kvision/form/upload/UploadInput.kt index da35f9ef..2af7b3f7 100644 --- a/kvision-modules/kvision-upload/src/main/kotlin/pl/treksoft/kvision/form/upload/UploadInput.kt +++ b/kvision-modules/kvision-upload/src/main/kotlin/pl/treksoft/kvision/form/upload/UploadInput.kt @@ -254,11 +254,11 @@ 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 { + return (getElementJQueryD()?.fileinput("getFileStack") as? Array<File>)?.toList()?.map { val kFile = KFile(it.name, it.size, null) nativeFiles[kFile] = it kFile - } + } ?: listOf() } /** @@ -266,7 +266,7 @@ open class UploadInput(uploadUrl: String? = null, multiple: Boolean = false, cla * @return value as a String */ fun getValueAsString(): String? { - return value?.joinToString { it.name } + return value?.joinToString(",") { it.name } } /** diff --git a/src/main/kotlin/pl/treksoft/kvision/form/FormControl.kt b/src/main/kotlin/pl/treksoft/kvision/form/FormControl.kt index 6759fef9..3af41690 100644 --- a/src/main/kotlin/pl/treksoft/kvision/form/FormControl.kt +++ b/src/main/kotlin/pl/treksoft/kvision/form/FormControl.kt @@ -218,5 +218,5 @@ interface KFilesFormControl : FormControl { if (v == null) value = null } - override fun getValueAsString(): String? = value?.joinToString { it.name } + override fun getValueAsString(): String? = value?.joinToString(",") { it.name } } |