Android Question Send image to database sql with php

gregorio_adrian_gimenez

Active Member
Licensed User
]Hello! I need an example of how to send an image to a SQL database with PHP, to save the image in a field blob. I loaded the image in a imageview field. now I can send string data types correctly, but also need to send a picture regards

B4X:
sub Boton_Click

  job2.Initialize ( "insertp", Me)
  job2.Download2("http://www.inteliquestion.com/acceso_base_datos.php", Array As String ("nombre", nombre.Text ,"apellido" ,apellido.Text,"Ntelefono" ,Ntelefono.Text))
  nombre.Text = ""
  apellido.Text = ""
    ToastMessageShow("registro ingresado",True)
   

End Sub


Sub JobDone (Job As HttpJob)
  Log("JobName = " & Job.JobName & ", Success = " & Job.Success)
  If Job.Success = True Then
      Select Job.JobName
        Case "InsertP"
            'print the result to the logs
            Log(Job.GetString)
        Case "OtherFunction"
            'Do some things
      End Select
  Else
      Log("Error: " & Job.ErrorMessage)
      ToastMessageShow("Error: " & Job.ErrorMessage, True)
  End If
  Job.Release
End Sub
 
Last edited:

Erel

Administrator
Staff member
Licensed User
The PHP script from the MySQL tutorial doesn't support blobs. It is recommended to switch to RDC which is more powerful, faster, simpler, more secure and support blobs.

If the bitmap is not too large then you can convert it to a base 64 string and treat it as a text field.
 
Top