Camera & WEB 2 - XOJO 2021

Is it possible to take a photo and save it in the database, using WEB 2?

I am looking for it to be compatible with mobile devices.

Not sure about Web 2 alone but I use the GraffitiSuite add on and that has a camera module.


Users may take a picture and then pick it for upload with a WebFileUploader control.

1 Like

Thank you Mark & Christian for your responses.

I try both options. They both work fine.
I chose WebFileUploader because it is fast and allows you to control the image that you are going to put in the database.

Hello, how have you solved it? It happens to me that many images of the cell phone do not allow me to load them, perhaps because of the size they occupy, but being a photo there are no alternatives.
I have a project where it records an image to BD Mysql but there are times when it doesn’t do it right, the image is cut off.
Do you have an example that works for you?

Hola Mauricio !

Como mencione, el mas eficiente fue usar el objeto FileUploader, para nuestro caso.

Siguiendo los siguientes pasos:
1.En una p√°gina web, poner el objeto FileUploader.
2. Adicionar el evento UploadFinished.
3. Copiar el siguiente código en este evento:

Session.DBlink.SQLExecute("BEGIN TRANSACTION")

For Each file As WebUploadedFile In files
  Var oid As Integer = Session.DBlink.CreateLargeObject
  If oid < 1 Or Session.DBlink.Error Then
MessageBox ("Error tratando de generar OID")
  End If
  Var lo As PostgreSQLLargeObject = session.DBlink.OpenLargeObject(oid)
  // ***************************************************************************
  Var row As New DatabaseRow
  row.Column("nlodata_id").StringValue = oid.ToText
  row.Column("cNombre").StringValue = file.Name
Session.DBlink.AddRow("tab_Archivos", row)
  Catch error As DatabaseException
MessageBox ("Error al intentar crear una consulta nueva (P2)."+EndOfLine+"DB Error: " + error.Message)
  End Try
  // ***************************************************************************

Session.DBlink.SQLExecute("END TRANSACTION")
If session.DBlink.Error Then
  MessageBox ("DB Error: " + Session.DBlink.ErrorMessage)
  MessageBox ("Archivo subido con éxito al servidor!!!")
End If
  1. Adicionar un botón.
  2. En el evento Pressed, poner este código:


Nota. El ejemplo esta hecho para usar PostgreSQL. Es importante que tengas el objeto DBlink creado para esta conexión.
Con esto, no he encontrado problemas para subir fotos de alta resolución.


Muchas Gracias!