Finally this code worked!
Thank you Mike!
Blob lblob_file,&
lblob_data
Integer li_FileNum,li_rtc
String ls_url = 'http://10.0.0.10:5005/subir',&
ls_uuid,&
ls_boundary,&
ls_token='mlk41kALGOKzdls',&
ls_bucket='ordenes'
httpclient lhc_httpclient
li_FileNum = FileOpen('c:\homero.jpg',StreamMode!)
IF li_FileNum = -1 THEN Return -1
li_rtc = FileReadEx(li_FileNum, lblob_file)
IF li_rtc = -1 THEN Return -2
FileClose(li_FileNum)
lhc_httpclient = create httpclient
ls_boundary = '----WebKitFormBoundary7MA4YWxkTrZu0gW'
lhc_httpclient.SetRequestHeader("Content-Type", "multipart/form-data; boundary="+"~r~n"+ls_boundary)
//Data
lblob_data = blob ("--" + ls_boundary + "~r~n" + &
'Content-Disposition: form-data; name="token"' + &
"~r~n~r~n" + ls_token + "~r~n", EncodingUTF8!)
lblob_data += blob ("--" + ls_boundary + "~r~n" + &
'Content-Disposition: form-data; name="bucket"' + &
"~r~n~r~n" + ls_bucket + "~r~n", EncodingUTF8!)
lblob_data += blob ("--" + ls_boundary + "~r~n" + &
'Content-Disposition: form-data; name="file"; filename="homero.jpg"' + &
"~r~n" + "Content-Type:image/jpeg" + "~r~n~r~n", EncodingUTF8!) +&
lblob_file + Blob("~r~n--"+ls_boundary+"--" + "~r~n", EncodingUTF8!)
lhc_httpclient.SetRequestHeader("Content-Length", String(len(lblob_data)))
li_rtc = lhc_httpclient.SendRequest( 'POST', ls_url, lblob_data)
IF li_rtc <> 1 THEN Return -3
li_rtc = lhc_httpclient.GetResponseStatusCode()
MessageBox("",li_rtc)
IF li_rtc <> 200 THEN Return li_rtc
lhc_httpclient.GetResponseBody(ls_uuid)
MessageBox("Uuid!",ls_uuid)
Return 1
THX for sharing. Great for future developers looking for working solutions!
Tip: I often create and use this constant for easier reading of string expressions: CONSTANT string EOL = "~r~n"
. . . + BLOB(EOL + "--" + ls_boundary + "--" + EOL, EncodingUTF8!)
Thank you Michael!!
Cheers,
KR