From f3254ca6996404562833656b7adb3afe05315ff5 Mon Sep 17 00:00:00 2001 From: cipchk Date: Tue, 22 May 2018 00:37:47 +0800 Subject: [PATCH] feat(uploader): params before file data, close #104 --- components/uploader/uploader.class.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/components/uploader/uploader.class.ts b/components/uploader/uploader.class.ts index f2b7411..2cd32ae 100644 --- a/components/uploader/uploader.class.ts +++ b/components/uploader/uploader.class.ts @@ -354,13 +354,11 @@ export class Uploader { if (!this._options.disableMultipart) { sendable = new FormData(); - sendable.append(item.options.alias, item._file, item.file.name); + Object.keys(this._options.params || {}).forEach((key: string) => + sendable.append(key, this._options.params[key]), + ); - if (this._options.params !== undefined) { - Object.keys(this._options.params).forEach((key: string) => { - sendable.append(key, this._options.params[key]); - }); - } + sendable.append(item.options.alias, item._file, item.file.name); } else { sendable = item._file; }