Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

EmilMoe's avatar
Level 10

Reset Input File

How do I reset an input file after upload? I have read something that I need to recreate it? My element looks like this

                <input
                        v-if="! currentNote"
                        type="file"
                        v-el:file
                        name="file">
0 likes
3 replies
joedawson's avatar
Level 18

If you're using v-model you can set it to null once the upload has finished.

<input
    v-if="! currentNote"
    type="file"
    v-el:file
    v-model="file">
data: function() {
    return {
        file: null
    }
},

methods: {
    
    uploadFile: function() {
        // upload the file...

        this.file = null; // cleared
    }

}
1 like
phx93's avatar

I would suggest something more generic: this.$data = this.$options.data();

Please or to participate in this conversation.