iOS Question Upload image to my server

DactilPlus

Member
Licensed User
Longtime User
I can load a image to a imageview, but i want use this image as user avatar and I need upload this image to my server.

B4X:
Sub Cam_Complete (Success As Boolean, Image As Bitmap, VideoPath As String)
    If Success Then
        If Image.IsInitialized Then
            ImageView_mi_foto.Bitmap = Image       
        Else
            hd.ToastMessageShow("Error loading image",True)
        End If
    End If
End Sub

I upload other files created by me but i dont know how can find and upload the image. I B4A i did it easy.


Example in B4A:
B4X:
Sub chooser_Result (Success As Boolean, Dir As String, FileName As String)
    If Success Then
        ImageView_mi_foto.Bitmap=LoadBitmap(Dir,FileName)
        Dim realPath As String = GetPathFromContentResult(FileName)
        Log("realPath = " & realPath)

Dim x_t,xm,long_imh As Int
long_imh=realPath.Length
Dim t_c As String
Do While t_c <> "/"
            x_t = x_t + 1
            t_c=realPath.SubString2(long_imh-x_t ,long_imh-x_t + 1)
Loop

Log (x_t)

Dim direc , img As String
        img = realPath.SubString2(long_imh-x_t + 1,long_imh )
        direc=realPath.SubString2(0,long_imh-x_t+1)
    Dim fecha2,hora2 As String
        DateTime.DateFormat = "yyyy/MM/dd"
        DateTime.TimeFormat = "HH:mm:ss"
        hora2 = DateTime.Time(DateTime.Now)
        fecha2=fecha2.Replace("/","")
        hora2=hora2.Replace(":","")
        nombre_gimg_ca =fecha2 & hora2 & img

        el_ftp_img.UploadFile(direc,img,True, "/" & nombre_gimg_ca )   
    Else
        ToastMessageShow("No image selected", True)
    End If
End Sub

How i can upload in B4i?
 
Last edited:
Top