try to print the parameter that you got in handleFileInput like below and see if you are getting the files
handleFileInput(files: FileList) {
const n = files.length;
for(let i = 0; i < n; ++i) {
console.log(files[i]);
}
console.log(files);
console.log('File type: ', files[0].type);
return null;
}
for files, you can specify mime type that are standard for extensions like this in input element
<input type="file"
accept=".doc,.docx,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document">
for more info, please refer this
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#accept
for microsoft office files
https://docs.microsoft.com/en-us/previous-versions/office/office-2007-resource-kit/ee309278(v=office.12)?redirectedfrom=MSDN
after applying the meme type from above references I am getting this output for .xlsx
File
?
lastModified: 1610551870303
?
name: "ALL.xlsx"
?
size: 11503152
?
type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
?
webkitRelativePath: ""
?
and for .docx
File
?
lastModified: 1608029273000
?
name: "aaa.docx"
?
size: 64618
?
type: "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
?
webkitRelativePath: ""
?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…