Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File type is empty for .doc and .docx #429

Open
lucianobosco opened this issue Jul 6, 2022 · 0 comments
Open

File type is empty for .doc and .docx #429

lucianobosco opened this issue Jul 6, 2022 · 0 comments

Comments

@lucianobosco
Copy link

lucianobosco commented Jul 6, 2022

I'm using the Vue 3 version. Whenever I try to upload a .doc .docx file the newFile.type is empty, therefore I'm not able to validate on inputFilter

I'm aware that I can check file type as per filename as explained in docs, but it doesn't fill very trustworthy. Instead, I'd like to check with file type as I use to do with any other file (which works as expected)

The odd thing is that .xls and .xlsx files work fine returning this in newFile.type:

.xlsx => type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
.xls => type: "application/vnd.ms-excel"

Any advice will be appreciated

const inputFilter = (newFile, oldFile, prevent) => {
      console.log(newFile, oldFile)
      // Handle new file
      if (newFile && !oldFile) {
        // Check valid extension
        if (!accept.includes(newFile.type)) {
          alert('Tipo de archivo no valido')
          return prevent()
        }
     }
}

The log returns this

{
  active: false
  data: {}
  error: ""
  file: File 
  lastModified: 1657148890308
  lastModifiedDate: Wed Jul 06 2022 20:08:10 GMT-0300 (Argentina Standard Time) {}
  name: "IMBATIBLE 2019 CICLO SUPERIOR Cs Sociales.doc"
  size: 93184
  type: ""
  webkitRelativePath: ""
  fileObject: true
  headers: {...}
  id: "9716pv89zvt"
  name: "IMBATIBLE 2019 CICLO SUPERIOR Cs Sociales.doc"
  postAction: "http://api.foobar.test/files"
  progress: "0.00"
  putAction: undefined
  response: {}
  size: 93184
  speed: 0
  success: false
  timeout: 0
  type: ""
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant