Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. this.$store.dispatch('setFiles', {files: window.images});
  2. // console.log(window.images) shows a proper FileList object
  3.  
  4. var bodyFormData = new FormData();
  5. Array.from(this.$store.state.files).forEach(file => {
  6. bodyFormData.append('files[]', file);
  7. });
  8. axios.post('localhost/api/uploadFile', bodyFormData,
  9. { headers: { 'Content-Type':'multipart/form-data'}
  10. })
  11. .then(res => console.log(res.data)
  12. .catch(err => console.log(err.response));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement