iOS Question [SOLVED] send album image

Maicon

Member
Licensed User
Longtime User
Hello everyone,

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
 

Maicon

Member
Licensed User
Longtime User
The problem was solved, the solution is to copy the image to some directory and use it later.
 
Upvote 0
Solution
Cookies are required to use this site. You must accept them to continue using the site. Learn more…