How do I upload an image with Vue-Resource!?
I have tried in many ways but I can not! Does anyone have a working example?
How do I upload an image with Vue-Resource!?
I have tried in many ways but I can not! Does anyone have a working example?
I got it !!
Someone needs to know:
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 dd($request->all())
that the file will be there!