If you need to set the Content-type, you can do that in the properties tab of 
InvokeHTTP. You can hit the plus button, and enter 'Content-type' as the 
property name, and the multipart/form-data as the value. If you right click on 
the Processor, and scroll down to Dynamic Properties, it lists that you can add 
a 'Header Name' to the request.

I've done this myself with User-Agent, so I am not sure why this shouldn't work 
with Content-type.

John
--------------------------------------------
On Mon, 3/18/19, Nattaphol Lertpaibulpanya <[email protected]> wrote:

 Subject: How to upload a file by using InvokeHTTP (multipart/form-data)?
 To: "[email protected]" <[email protected]>
 Date: Monday, March 18, 2019, 5:24 AM
 
 
 
  
 
 
 
 
 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? Could you suggest how to update a file by
 using InvokeHTTP processor?
 
 
 
 
 
 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
 
 
 
 
 
 
 
 
 
 Picture2
 
 
 
 
 
 
 
 
 
 
 
 
 
 Picture3: content in the flow file
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 Sent from 
 Outlook
 
 
 
 
 

Reply via email to