Dim by As InputStream
by = File.OpenInput(data(1),filename)
Dim ff As String
Dim tr As TextReader
tr.Initialize2(File.OpenInput(data(1),filename),"UTF-8")
ff = tr.ReadAll
tr.Close
Dim msg As Map
msg.Initialize
msg.Put("01","POST /hapld/tos/kdwhapltos HTTP/1.1"&CRLF)
msg.Put("02","Host: www.pld-certify.ups.com"&CRLF)
msg.Put("03","Content-type: multipart/mixed; boundary=BOUNDARY"&CRLF)
msg.Put("04","Content-length: " & lenght &CRLF)
msg.Put("05",CRLF)
msg.Put("06","--BOUNDARY"&CRLF)
msg.Put("07","Content-type: application/x-www-form-urlencoded"&CRLF)
msg.Put("08","Content-length: 136"&CRLF)
msg.Put("09",CRLF)
msg.Put("10","AppVersion=1.0&AcceptUPSLicenseAgreement=Yes&ResponseType=application/x-ups-pld&VersionNumber=V4R1&UserId=" & data(4) & "&Password=" & data(5) &CRLF)
msg.Put("11",CRLF)
msg.Put("12","--BOUNDARY"&CRLF)
msg.Put("13","Content-type: application/x-ups-binary"&CRLF)
msg.Put("14",ff&CRLF)
msg.Put("15",CRLF)
msg.Put("16","--BOUNDARY--"&CRLF)
Dim ser As B4XSerializator
Dim b() As Byte = ser.ConvertObjectToBytes(msg)
Try
mHTTP.InitializeAcceptAll("HTTPS")
Dim req As OkHttpRequest
req.InitializePost2(data(3),b)
mHTTP.Execute(req,1000)
ListView2.Items.Add(Chr(0xF05A)&" File inviato correttamente !")
Catch
ListView2.Items.Add(Chr(0xF071)&" Errore nell'invio del file !")
If controller <> "" Then
ControlMail(action,controller,Chr(0xF071)&BytesToString(out.ToBytesArray, 0, out.ToBytesArray.Length, "utf8"))
End If
End Try
End Try