Skip to content

Commit

Permalink
Merge pull request valor-software#658 from kopertop/development
Browse files Browse the repository at this point in the history
Adds some Fixes for AWS Support.
  • Loading branch information
Adrian Fâciu authored Oct 7, 2017
2 parents 631b4aa + a333c59 commit e1bc9ff
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/file-upload/file-uploader.class.ts
Original file line number Diff line number Diff line change
Expand Up @@ -315,13 +315,20 @@ export class FileUploader {
sendable = new FormData();
this._onBuildItemForm(item, sendable);

sendable.append(item.alias, item._file, item.file.name);

// For AWS, Additional Parameters must come BEFORE Files
if (this.options.additionalParameter !== undefined) {
Object.keys(this.options.additionalParameter).forEach((key:string) => {
sendable.append(key, this.options.additionalParameter[key]);
let paramVal = this.options.additionalParameter[key];
// Allow an additional parameter to include the filename
if (typeof paramVal === 'string' && paramVal.indexOf('{{file_name}}') >= 0) {
paramVal = paramVal.replace('{{file_name}}', item.file.name);
}
sendable.append(key, paramVal);
});
}

sendable.append(item.alias, item._file, item.file.name);
} else {
sendable = this.options.formatDataFunction(item);
}
Expand Down

0 comments on commit e1bc9ff

Please sign in to comment.