<template>

  <div>

    <label for="fileUpload">Datei</label>
    <input id="fileUpload" type="file"
      @change="handleFileUpload( $event) "
    /><br>
    <button v-on:click="submitFile()">Upload</button>
  </div>

</template>

<script>
import axios from 'axios';

export default {
  name: "FileUpload",
  data() {
    return {
      file: ''
    }
  },
  methods: {
    handleFileUpload(event) {
      this.file = event.target.files[0];
    },
    submitFile() {
      let formData = new FormData();
      formData.append('file',this.file);

      axios.post( '^/api/fs/billibox/assets',
        formData,
          {
            headers: {
              'Content-Type': 'multipart/form-data'
            }
          }

      ).then((res) => {
        console.log("FileUpload Success", res.data);
      }).catch((err) => {
        console.log(err);
      })

    }
  }
}
</script>

<style scoped>

</style>