Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- this.$store.dispatch('setFiles', {files: window.images});
- // console.log(window.images) shows a proper FileList object
- var bodyFormData = new FormData();
- Array.from(this.$store.state.files).forEach(file => {
- bodyFormData.append('files[]', file);
- });
- axios.post('localhost/api/uploadFile', bodyFormData,
- { headers: { 'Content-Type':'multipart/form-data'}
- })
- .then(res => console.log(res.data)
- .catch(err => console.log(err.response));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement