iOS Question ios ihttputils2 multipart post

Michael Stewart

Member
Licensed User
Hi,

I have an android app written on B4a (7.80)

I'm attempting to move it over to B4i (4.4)

It performs a multipart post to an asp.net generic handler (.ashx)

------ B4x ------


'Send the report up here + the 6 photos
Dim j As HttpJob
j.Initialize("sendresults", Me)

Dim ImagesCursor As ResultSet
Dim Filename As String
Dim Filetext As String

Dim Files As List

Files.Initialize

ImagesCursor = SQLMain.ExecQuery2("SELECT * FROM tablet where tabletid =? and ID=?"),Array(1,1))

Do While ImagesCursor.NextRow

Filename = ImagesCursor.GetString("ImagePath")
Filetext = ImagesCursor.GetString("ImageText")

If File.Exists(File.DirTemp,Filename) Then

Dim myfile As MultipartFileData

myfile.Initialize

myfile.KeyName = "fd1"

myfile.Dir = File.DirTemp 'File.DirRootExternal

myfile.FileName = Filename

myfile.ContentType = "image/jpeg"

Files.Add(myfile)

End If

Loop

'Post results to server
j.PostMultipart(serverurl & "/handlers/sendresults.ashx", CreateMap("ID":ID),Files)


'j.PostString(serverurl & "/handlers/sendresults.ashx",ID & "_true")

'Dim res As String
Wait For (j) JobDone(j As HttpJob)
If j.Success Then

Msgbox ("Results sent successfully","")


End If

--------------------

----- sendresults.ashx ------

public void ProcessRequest(HttpContext context)
{
string connString = ConfigurationManager.ConnectionStrings["SqlConnectionString"].ConnectionString;

string returnval = "";

HttpPostedFile file;

int filecount = context.Request.Files.Count;

int ID = Convert.ToInt32(context.Request["ID"]);
}

-------------------

It works no problem with identical code on Android, but on iOS using ihttputils2 I get no readable context response (filess or context requests).

(poststring will work)

Does anyone know if there is a difference with the way the httputils2 library works on iOS.

Thanks.

Michael.
 
Top