We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
作者,你好,在开发客户端的时候调用方法 'multipartUpload'时报错,报错信息如下:
ERROR Error: Uncaught (in promise): Error: _getFileSize requires Buffer/File/String. Error: _getFileSize requires Buffer/File/String.
请问,怎么会事儿?如何解决?thank you!
附,其他信息: 1、使用的是angular4框架,组件化开发; 2、语言:typescript; 3、此组件所有代码如下:
`import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
declare const OSS: any;
@component({ selector: 'app-file-upload-oss', templateUrl: './file-upload-oss.component.html', styleUrls: ['./file-upload-oss.component.scss'] })
export class FileUploadOssComponent implements OnInit {
// configuration parameter @input() type?: String = 'rectangle'; @input() region: string; @input() accessKeyId: string; @input() accesskey: string;
@input() set bucket(val: string) { if (val !== '' && val.indexOf('/') !== val.length - 1) { val = val + '/'; } this._bucket = val; }; get bucket(): string { return this._bucket; };
@output() uploadStatus = new EventEmitter();
_bucket: string; filesList: any[] = [];
// Handle files handleFiles(files: any[]) { return new Promise((resolve) => { for (const file of files) { file['loading'] = false; file['remove'] = false; file['percent'] = 0; }; resolve(files); }); };
// click select files clickSelectFiles($event: any) { this.filesList.length = 0;
this.handleFiles($event.target.files).then((files: any[]) => { this.filesList.push(...files); });
};
// dragover preventDefault dragover($event: any) { $event.preventDefault(); };
// drop select files dropSelectFiles($event: any) { $event.preventDefault();
this.handleFiles($event.dataTransfer.files).then((files: any[]) => { this.filesList.push(...files); });
// remove files removeFile(index: number) { this.filesList[index]['removeAnimation'] = 'fadeOutRight'; setTimeout(() => { this.filesList.splice(index, 1); }, 300); };
// upload files uploadFile() { const file = document.getElementById('btn')['files'][0]; const files = this.filesList; const key = 'object';
const client = new OSS.Wrapper({ region: this.region, accessKeyId: this.accessKeyId, accessKeySecret: this.accesskey, bucket: this.bucket }); client.multipartUpload(key, file, { progress: this.progress }).then(((res: any) => { alert(`${res}`); console.log('upload success'); this.uploadStatus.emit(res); }));
// upload progress progress(p: any) { console.log(进度${p}); };
进度${p}
constructor() { }
ngOnInit() { }
} `
The text was updated successfully, but these errors were encountered:
No branches or pull requests
作者,你好,在开发客户端的时候调用方法 'multipartUpload'时报错,报错信息如下:
ERROR Error: Uncaught (in promise): Error: _getFileSize requires Buffer/File/String.
Error: _getFileSize requires Buffer/File/String.
请问,怎么会事儿?如何解决?thank you!
附,其他信息:
1、使用的是angular4框架,组件化开发;
2、语言:typescript;
3、此组件所有代码如下:
`import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
declare const OSS: any;
@component({
selector: 'app-file-upload-oss',
templateUrl: './file-upload-oss.component.html',
styleUrls: ['./file-upload-oss.component.scss']
})
export class FileUploadOssComponent implements OnInit {
// configuration parameter
@input() type?: String = 'rectangle';
@input() region: string;
@input() accessKeyId: string;
@input() accesskey: string;
@input()
set bucket(val: string) {
if (val !== '' && val.indexOf('/') !== val.length - 1) {
val = val + '/';
}
this._bucket = val;
};
get bucket(): string {
return this._bucket;
};
@output() uploadStatus = new EventEmitter();
_bucket: string;
filesList: any[] = [];
// Handle files
handleFiles(files: any[]) {
return new Promise((resolve) => {
for (const file of files) {
file['loading'] = false;
file['remove'] = false;
file['percent'] = 0;
};
resolve(files);
});
};
// click select files
clickSelectFiles($event: any) {
this.filesList.length = 0;
};
// dragover preventDefault
dragover($event: any) {
$event.preventDefault();
};
// drop select files
dropSelectFiles($event: any) {
$event.preventDefault();
};
// remove files
removeFile(index: number) {
this.filesList[index]['removeAnimation'] = 'fadeOutRight';
setTimeout(() => {
this.filesList.splice(index, 1);
}, 300);
};
// upload files
uploadFile() {
const file = document.getElementById('btn')['files'][0];
const files = this.filesList;
const key = 'object';
};
// upload progress
progress(p: any) {
console.log(
进度${p}
);};
constructor() { }
ngOnInit() {
}
}
`
The text was updated successfully, but these errors were encountered: