Mark Iantorno
08/12/2020, 6:43 PMclass FileUploadComponent : RComponent<FileUploadProps, RState>() {
override fun RBuilder.render() {
styledInput(InputType.file, name = "fileUpload", formEncType = InputFormEncType.multipartFormData) {
css {
display = Display.none
}
attrs {
id = "FileUploadInput"
onInputFunction = {
event -> println("onInputFunction :: $event")
val input = document.getElementById("FileUploadInput") as HTMLInputElement
println("VALUE -> ${input.value}")
}
}
}
styledButton {
+"Upload Files"
attrs {
name = "UploadFileButton"
onClickFunction = {
val field = document.getElementById("FileUploadInput") as HTMLInputElement
field.click()
}
}
}
}
}
But that only does one file at a time, and not multiple files. I know if HTML you would just add something like <input id='file-input' type='file' multiple/>
and it would work, but I can't figure out how to add the multiple attribute to this input...
Any help would be greatly appreciated.janvladimirmostert
08/13/2020, 2:42 PMMark Iantorno
08/13/2020, 2:42 PMmultiple = true
in the attrs
sectionMark Iantorno
08/13/2020, 2:42 PMjanvladimirmostert
08/13/2020, 2:42 PM