Open
Description
Hello,
I've the following api service's method:
@POST('/my-custom-url')
@Multipart
async uploadFileFromBrowser(@Part('file') file: PartDescriptor<File>): Promise<Response<any>> {
return {} as Response;
}
I'm calling it (from an Angular project) with the following code:
async uploadAction() {
const fileInput = document.getElementById('file') as HTMLInputElement;
const files = fileInput.files;
const file = files[0];
const response = await this.api.uploadFileFromBrowser({value: file, filename: file.name});
}
When I call the uploadAction method the "filename field" is the string: "[object Object]" instead of the "textual name of file".
------WebKitFormBoundaryWY9IohJDLcjoMBw7
Content-Disposition: form-data; name="file"; filename="[object Object]"
Content-Type: image/png
[...]
Inside dataResolver.ts
, method resolve(headers: any, data: any)
the line n. 44 is:
formData.append(key, data[key].value, { filename: data[key].filename });
maybe should be:
formData.append(key, data[key].value, data[key].filename);
Best regards,
Daniele
Metadata
Metadata
Assignees
Labels
No labels