Fix #22: Unable to set form's "name" on file upload
This commit is contained in:
@@ -42,6 +42,7 @@ Follow me [ may expect the file to be streamed rather than sent via a form. Defaults to false.
|
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
|
### Events
|
||||||
|
|
||||||
|
|||||||
@@ -4,9 +4,9 @@ import { FileUploader, ParsedResponseHeaders, FileUploaderOptions } from './file
|
|||||||
export class FileItem {
|
export class FileItem {
|
||||||
public file:FileLikeObject;
|
public file:FileLikeObject;
|
||||||
public _file:File;
|
public _file:File;
|
||||||
public alias:string = 'file';
|
public alias:string;
|
||||||
public url:string = '/';
|
public url:string = '/';
|
||||||
public method:string = 'POST';
|
public method:string;
|
||||||
public headers:any = [];
|
public headers:any = [];
|
||||||
public withCredentials:boolean = true;
|
public withCredentials:boolean = true;
|
||||||
public formData:any = [];
|
public formData:any = [];
|
||||||
@@ -31,8 +31,9 @@ export class FileItem {
|
|||||||
this.options = options;
|
this.options = options;
|
||||||
this.file = new FileLikeObject(some);
|
this.file = new FileLikeObject(some);
|
||||||
this._file = some;
|
this._file = some;
|
||||||
if (uploader.options && uploader.options.method) {
|
if (uploader.options) {
|
||||||
this.method = uploader.options.method;
|
this.method = uploader.options.method || 'POST';
|
||||||
|
this.alias = uploader.options.itemAlias || 'file';
|
||||||
}
|
}
|
||||||
this.url = uploader.options.url;
|
this.url = uploader.options.url;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ export interface FileUploaderOptions {
|
|||||||
removeAfterUpload?:boolean;
|
removeAfterUpload?:boolean;
|
||||||
url?:string;
|
url?:string;
|
||||||
disableMultipart?:boolean;
|
disableMultipart?:boolean;
|
||||||
|
itemAlias?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class FileUploader {
|
export class FileUploader {
|
||||||
|
|||||||
Reference in New Issue
Block a user