2
How do I upload an image with Vue-Resource!?
I’ve tried several ways but I can’t! Someone has a functional example?
2
How do I upload an image with Vue-Resource!?
I’ve tried several ways but I can’t! Someone has a functional example?
5
I got!!
Anyone still needs:
methods: {
send() {
let data = new FormData();
data.append('file', this.record.file)
this.$http.post('test', data);
},
upload(e) {
e.preventDefault();
var files = e.target.files;
this.record.file = files[0];
}
}
<div class="col-sm-12">
<input @change="upload" type="file">
</div>
<div class="col-sm-12">
<button @click="send">Send</button>
</div>
On the server just give a dd($request->all())
that the file will be there!
Browser other questions tagged vue.js
You are not signed in. Login or sign up in order to post.