data
})
- upload = (url: string, path: string, files: File[], config: WebDAVRequestConfig = {}) => {
- const fd = new FormData();
- fd.append('path', path);
- files.forEach((f, idx) => {
- fd.append(`file-${idx}`, f);
- });
-
- return this.request({
- ...config, url,
- method: 'PUT',
- data: fd
- });
+ upload = (url: string, files: File[], config: WebDAVRequestConfig = {}) => {
+ return Promise.all(
+ files.map(file => this.request({
+ ...config, url,
+ method: 'PUT',
+ data: file
+ }))
+ );
}
copy = (url: string, destination: string, config: WebDAVRequestConfig = {}) =>
return new Promise<XMLHttpRequest>((resolve, reject) => {
const r = this.createRequest();
r.open(config.method, this.defaults.baseURL + config.url);
-
const headers = { ...this.defaults.headers, ...config.headers };
Object
.keys(headers)
headers?: { [key: string]: string };
data?: any;
onUploadProgress?: (event: ProgressEvent) => void;
-}
+}
\ No newline at end of file