Hello everyone,
how can i be uploading an iphone album file to upload via j.PostMultipart?
I use this code on android
I need to know how I can send the bitmap in the filename and the directory
how can i be uploading an iphone album file to upload via j.PostMultipart?
B4I:
Sub InitCamera
cam.Initialize("cam", B4XPages.GetNativeParent(Me))
End Sub
Sub btnChoosePicture_Click
InitCamera
cam.SelectFromSavedPhotos(Sender, cam.TYPE_IMAGE)
End Sub
I use this code on android
B4X:
Sub uploadImagem (filename As String, dir As String)
Dim j As HttpJob
Dim img As String = filename
j.Initialize("", Me)
Dim mp As MultipartFileData
mp.Initialize
mp.Dir = dir
mp.FileName = img
mp.KeyName = "foto"
mp.ContentType = "image/jpg"
Dim map As Map = CreateMap("id_os": 3, "etapa": "INICIO")
j.PostMultipart(host&"api/funcionario/enviarFoto", map, Array(mp))
j.GetRequest.SetHeader("Authorization","token")
Wait For (j) JobDone(j As HttpJob)
If j.Success Then
Dim parser As JSONParser
parser.Initialize(j.GetString)
Dim jRoot As Map = parser.NextObject
Dim Success As String = jRoot.Get("Success")
Dim Erro As String = jRoot.Get("Erro")
If Success = "Foto enviada" Then
CONFIG_STYLE.mostrarToastMessage(Root, Success)
' carregarOS
Else
CONFIG_STYLE.mostrarToastMessage(Root, Erro)
End If
End If
j.Release
End Sub
I need to know how I can send the bitmap in the filename and the directory