FoxPro Programming
Multi-part Form
Gravatar is a globally recognized avatar based on your email address. Multi-part Form
  Georgios Kotsolakos
  All
  Sep 7, 2025 @ 09:49pm

How to implement the following VB code in Multi-part Form Uploads using wwHTTP.

Dim client As New RestClient(https://www.newsite.somesite.gr/flexboard_api.php?type=invoice&action=upload)
Dim RestReq As New RestRequest(Method.POST)

RestReq.AddHeader("Content-Type", "multipart/form-data")
 RestReq.AddHeader("Cookie", "tk=examplecookiesomsN593kJlj2QqjmyWzx7qQjLE")   
  RestReq.AddFile("xml", TmpFileName & ".xml", "application/xml")
  RestReq.AddFile("invoice_xml", UBLFileName & ".xml", "application/xml")
RestReq.AddParameter("user", "DemoEskap")
RestReq.AddParameter("password", " K@pp@D3v")
RestReq.AddParameter("customers_id", TmpCustId)

Gravatar is a globally recognized avatar based on your email address. re: Multi-part Form
  Georgios Kotsolakos
  Georgios Kotsolakos
  Sep 8, 2025 @ 08:07am

in vb code there is RestReq.AddParameter("user", "DemoUser") what is the equivalent in wwHttp ;

Gravatar is a globally recognized avatar based on your email address. re: Multi-part Form
  Rick Strahl
  Georgios Kotsolakos
  Sep 8, 2025 @ 09:16am

It's in the example: .AddPostKey("user","DemoUser").

*** Post a file as a Form variable
oHttp.AddPostFile("upload","c:\sailbig.jpg",.T.,"image.png","image/png")

*** Optionally there may be other form variables on the form
oHttp.AddPostKey("notes","Notes about the image uploaded")

+++ Rick ---

© 1996-2025