angular - DevExtreme 文件上传 - 获取组件中的文件内容
问题描述
我想使用 DevExtreme dxFileUploader 上传文件并在组件中处理其内容(不使用服务 url)。
我正在使用 Angular 8.2.2 和 DevExtreme 19.1。我尝试使用 onValueChange 事件处理文件,但我只获取文件的属性(文件名、文件大小等)而不是内容本身。
app.component.html:
<dx-file-uploader #fileUploader (onValueChanged)="processFile($event)"
[multiple]="false" accept="*" [(value)]="value" uploadMode="useButtons">
</dx-file-uploader>
app.component.ts:
public value: any[] = [];
processFile(e) {
console.log(this.value); // shows only file attributes
}
有没有办法从 dxFileUploader 控件访问文件内容?
解决方案
processFile(e) {
console.log(e.value[0]);
}
推荐阅读
- python - 卷曲请求在终端中工作正常,但在转换后无法在 python 中工作
- python - 输入函数中的 TensorFlow 数据集方法调用序列
- c# - LinkButton 需要像进度条的 Button 一样工作
- amazon-web-services - AWS AppSync 是否适用于 Xamarin?
- kubernetes - 如何使用 helm 模板创建 toml 数组?
- time-complexity - 这个函数的时间复杂度是 O(n * (n * log n² ))
- ios - 如何使用 Swift 包管理器添加依赖项
- java - 删除添加的按钮 Vaadin
- powershell - PowerShell 检查丢失的 ShadowCopies
- javascript - Google Publisher Tag 是否有槽渲染失败事件?