Adds some Fixes for AWS Support. #658

Merged
kopertop merged 3 commits from development into development 2017-10-07 09:06:23 +00:00
Showing only changes of commit 0e17d55633 - Show all commits

View File

@@ -307,13 +307,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 (paramVal.indexOf('{{file_name}}') >= 0) {
paramVal.replace('{{file_name}}', item.file.name);
}
sendable.append(key, paramVal);
});
}
sendable.append(item.alias, item._file, item.file.name);
} else {
sendable = item._file;
}