Merge pull request #658 from kopertop/development

Adds some Fixes for AWS Support.
This commit was merged in pull request #658.
This commit is contained in:
Adrian Fâciu
2017-10-07 12:06:23 +03:00
committed by GitHub

View File

@@ -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);
}