You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@nifi.apache.org by Nattaphol Lertpaibulpanya <na...@hotmail.com> on 2019/04/01 06:46:22 UTC

How to upload a file by using InvokeHTTP (multipart/form-data)?

Hi,

I try to use InvokeHTTP processor to upload a file and got some error. I had a HTTP POST message that I tested by using Postman and everything ok.

I try to implement in NIFI but I cannot change the Content-Type by using UpdateAttribute processor as I searched in the internet. Nifi still used the default value as Picture1 and I guess it produced the error in the Picture2 due to it could not find the username field that I sent in the flowfile content as a multipart/form-data.

What I did wrong?

Regards,
Nattaphol L.

===============================
POST /xxx/dropfile/ HTTP/1.1
Host: xxx
Cache-Control: no-cache
Postman-Token: 21171a40-f903-aea3-3fda-49092758f5ce
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW

------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="username"

test
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="file"; filename="xxx.json"
Content-Type: application/json


------WebKitFormBoundary7MA4YWxkTrZu0gW--

===============================

Picture1
[cid:713ad3d1-eb6f-4c89-a2f9-e2eb8b834de2]

Picture2
[cid:c4bf6c5f-8885-43c9-9c25-7dd6ecece0e6]


Picture3: content in the flow file
[cid:40fd8c55-4f1e-4814-a543-59b20ab050d7]



Sent from Outlook<http://aka.ms/weboutlook>