ngx-dropzone
[accept]="'application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'"
[multiple]="false"
(change)="onFileDropped($event)"
style="overflow: unset;">
Drag & drop your Excel file here or click to browse
< /code>
Это мой html < /p>
onFileDropped(event:any) {
if (event.rejectedFiles.length > 0) {
this.spinner.hide();
this.globalService.showError('Invalid File Format. Supported file formats are xls,xlsx');
} else {
const acceptedFormats = [
'application/vnd.ms-excel', // .xls
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' // .xlsx
];
const isValid = event.addedFiles.every((file: File) => acceptedFormats.includes(file.type));
if (!isValid) {
this.globalService.showError('Invalid File Format. Supported file formats are xls, xlsx');
return;
}
console.log(event.addedFiles)
this.headerFiles = [];
this.headerImageSrc = [];
this.headerFiles.push(...event.addedFiles);
}
}
< /code>
Это моя проблема с компонентом
, когда я переполняю код на хромированном перетаскивании и выпуске, не работает, но нажимайте на Dropzone, и он открывает файл, исследуйте
, но другие браузеры i i Протестированные Firefox, Edge хорошо работают с перетаскиванием файла с использованием того же блока кода
Подробнее здесь: https://stackoverflow.com/questions/794 ... -file-drop
Google Chrome версия 133.0.6943.99 не поддерживает угловой файл ngx-dropzone ⇐ Javascript
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение