# Vuetify file upload - v-file-input

**URL:** <https://discourse.nodered.org/t/vuetify-file-upload-v-file-input/86087>\
**Category:** Dashboard\
**Tags:** dashboard-2\
**Created:** [3 March 2024 10:40 UTC](https://discourse.nodered.org/t/vuetify-file-upload-v-file-input/86087 "2024-03-03T10:40:12Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [3 March 2024 12:27 UTC](https://discourse.nodered.org/t/vuetify-file-upload-v-file-input/86087/2 "2024-03-03T12:27:06Z")

</div>

If you add `debugger` statement in your function, you can clearly see that `this.chosenFile` is an array

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/2/720999702ecfa1924d8c509950500817252dc2a8.png)

FileReader is for a "file"

Adjust your code:

```auto
            importTxt() {
                console.log('import')
                if (!this.chosenFile) {
                    this.data = "No File Chosen";
                } else {
                    console.log("File selected");
                    console.log(this.chosenFile);
                    if (!this.chosenFile || this.chosenFile.length !== 1) {
                        console.warn('expected chosenFile to contain 1 item')
                        return
                    }
                    const reader = new FileReader();
                    
                    // Use the javascript reader object to load the contents
                    // of the file in the v-model prop
                    reader.readAsText(this.chosenFile[0]);
                    reader.onload = () => {
                        this.data = reader.result;
                    }
                }
            }

```

Demo:  
 ![chrome_03LhxuCGwh](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/9/a919a362d9ca8e16e62a273c70e441b2b88765a3.gif)

---

_[View the full topic](https://discourse.nodered.org/t/vuetify-file-upload-v-file-input/86087)._
