2021年1月24日星期日

input type=file for .docx and .xlsx

I am implementing file upload function where I need to check for permitted file extension. Two permitted file extension are .docx, .xlsx. When I console log, it is not printing for the file extension if it is .docx and .xlsx.

<input type="file" id="file" formControlName="file" (change)="handleFileInput($event.target.files)" accept=".pdf,.docx,.xlsx,.png,.jpeg"/>    handleFileInput(files: FileList) {      console.log('File type: ' + files.item(0).type);      return null;  }  
https://stackoverflow.com/questions/65879314/input-type-file-for-docx-and-xlsx January 25, 2021 at 01:10PM

没有评论:

发表评论