vue.jsvue-formulate

What is the MIME validation for excel files on Vue Formulate.?


What is the MIME type for excel files on Vue Formulate

I've tried

<FormulateInput
      type="image"
      name="headshot"
      label="Select an image to upload"
      :uploader="uploadFile"
      help="Select a png, jpg or gif to upload."
      validation="mime:application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
    />

but this doesn't seem to work. how do I validate if the selected file is indeed a .xls or .xlsx file .?


Solution

  • The default mime list that vue formulate ships with is very small. However extending the list is pretty easy:

    import Vue from 'vue'
    import VueFormulate from '@braid/vue-formulate'
    
    Vue.use(VueFormulate, {
      mimes: {
        xls: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
        // ... any other mimes
      }
    })
    

    There's documentation around this here: https://vueformulate.com/guide/inputs/types/file/#mime-types

    Full Disclosure: I'm Vue Formulate’s author.