0

Actually I want user to upload a file from frontend and I want to send that file to server. I am using v-file-input but I dont know how to access the file once it is uploaded

<v-file-input type="file" label="Upload an image for your Avatar" prepend-icon="mdi-camera" @change="selectFile" ref="avatar"></v-file-input>

can someone tell me how can i access that file?

2
  • 1
    Give it a $ref and access the files object within Commented Dec 23, 2019 at 20:47
  • Thanks sir.. the issue got solved.. Commented Dec 24, 2019 at 17:54

1 Answer 1

1

You can use the v-model prop.

<v-file-input v-model="myFileObject"></v-file-input>

The myFileObject contains either a single file object, or is an array of file objects. You can find more on the v-file-input documentation.

You must also specify the myFileObject in your data.

data: () => ({
    myFileObject: null
})
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.