Skip to content

Commit

Permalink
Merge pull request valor-software#403 from serhiisol/set-forms-name
Browse files Browse the repository at this point in the history
Fix valor-software#22: Unable to set form's "name" on file upload
  • Loading branch information
valorkin authored Sep 21, 2016
2 parents b501163 + b886f78 commit 003f1eb
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ Follow me [![twitter](https://img.shields.io/twitter/follow/valorkin.svg?style=s
1. `url` - URL of File Uploader's route
2. `authToken` - Auth token that will be applied as 'Authorization' header during file send.
3. `disableMultipart` - If 'true', disable using a multipart form for file upload and instead stream the file. Some APIs (e.g. Amazon S3) may expect the file to be streamed rather than sent via a form. Defaults to false.
4. `itemAlias` - item alias (form name redefenition)

### Events

Expand Down
9 changes: 5 additions & 4 deletions components/file-upload/file-item.class.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import { FileUploader, ParsedResponseHeaders, FileUploaderOptions } from './file
export class FileItem {
public file:FileLikeObject;
public _file:File;
public alias:string = 'file';
public alias:string;
public url:string = '/';
public method:string = 'POST';
public method:string;
public headers:any = [];
public withCredentials:boolean = true;
public formData:any = [];
Expand All @@ -31,8 +31,9 @@ export class FileItem {
this.options = options;
this.file = new FileLikeObject(some);
this._file = some;
if (uploader.options && uploader.options.method) {
this.method = uploader.options.method;
if (uploader.options) {
this.method = uploader.options.method || 'POST';
this.alias = uploader.options.itemAlias || 'file';
}
this.url = uploader.options.url;
}
Expand Down
1 change: 1 addition & 0 deletions components/file-upload/file-uploader.class.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export interface FileUploaderOptions {
removeAfterUpload?:boolean;
url?:string;
disableMultipart?:boolean;
itemAlias?: string;
}

export class FileUploader {
Expand Down

0 comments on commit 003f1eb

Please sign in to comment.