【问题标题】:DevExtreme file upload - get file content in componentDevExtreme 文件上传 - 获取组件中的文件内容
【发布时间】:2019-09-06 07:21:20
【问题描述】:

我想使用 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 控件访问文件内容?

【问题讨论】:

    标签: angular devextreme


    【解决方案1】:
    processFile(e) {
        console.log(e.value[0]);
    }
    

    【讨论】:

    • 请描述建议的代码如何解决问题,并尝试包含更多细节。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-11-01
    • 2013-12-13
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多