From 71a6ffef968465ca48b98a70e561e0c981a41ac0 Mon Sep 17 00:00:00 2001 From: Phil Kunz Date: Fri, 20 Jul 2018 00:01:41 +0200 Subject: [PATCH] fix(core): update --- ts/smartrequest.formdata.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ts/smartrequest.formdata.ts b/ts/smartrequest.formdata.ts index 419d5c0..7163759 100644 --- a/ts/smartrequest.formdata.ts +++ b/ts/smartrequest.formdata.ts @@ -35,11 +35,13 @@ const appendFormField = async ( formDataField: IFormField ) => { if (formDataField.type === "filePath") { - formDataArg.append("type", "image"); - let fileData = plugins.fs.createReadStream( + let fileData = plugins.fs.readFileSync( plugins.path.join(process.cwd(), formDataField.payload) ); - formDataArg.append("media", fileData, "upload.pdf"); + formDataArg.append("file", fileData, { + filename: 'upload.pdf', + contentType: 'application/pdf' + }); } };