Commit abfda394 by Nakarin Luankla

UPDATE fileType

parent 43bce44b
......@@ -74,7 +74,7 @@ export class ListExcelComponent implements OnInit {
if (event.target.files && event.target.files[0]) {
const reader = new FileReader();
const file: File = event.target.files[0];
console.log("🚀 ~ ListExcelComponent ~ onSelectFile ~ file:", file.type)
console.log("🚀 ~ ListExcelComponent ~ onSelectFile ~ file:", file)
reader.readAsDataURL(event.target.files[0]); // read file as data url
reader.onload = (event) => { // called once readAsDataURL is completed
if(event){
......@@ -84,7 +84,7 @@ export class ListExcelComponent implements OnInit {
} else {
let base64 = event.target!.result as string
this.modelExcel.excelObj = base64.split(',')[1];
this.modelExcel.fileType = file.type
this.modelExcel.fileType = file.name.split('.')[file.name.split('.').length-1]
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment