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

835 views Asked by At

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 .?

1

There are 1 answers

0
jpschroeder On BEST ANSWER

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.