I want to get ListFile. I wrote this code.
    
    
    include karax / prelude
    
    proc createDom(): VNode =
      result = buildHtml(tdiv):
        h1:
          text "hello world"
        input(`type`="file"):
          text "click here"
          proc onchange(ev: Event, n: VNode) =
            echo ev[]
            echo ev.target[]
            echo n[]
    
    setRenderer createDom
    
    
    Run

But I couldn't find files or target.files.

I could get ListFile on JavaScript.
    
    
    <!DOCTYPE html>
    <html lang="en">
    
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta http-equiv="X-UA-Compatible" content="ie=edge">
        <title>Document</title>
        <script>
        
        window.onload = function() {
            const elem = document.getElementById('fileButton')
            elem.addEventListener('change', click)
        }
        
        function click(ev) {
            console.log(ev.target.files)  // I want to get this.
        }
        
        </script>
    
    </head>
    
    <body>
        <input id="fileButton" type="file" value="click" />
    </body>
    
    </html>
    
    
    Run

How can I get files in <input type="file">?

Reply via email to