Android Question How to take a picture and send it to a server

Alberto Michelis

Well-Known Member
Licensed User
Hi, having a Sqlite table in the phone, I need to take a picture for each record, save it on the phone and when connected, send the records and each picture to a web server.
Any idea of how to do it?
 

ronell

Well-Known Member
Licensed User
this is how i upload images on my webserver

B4A Code
B4X:
    dim tempImageFile As String = "tempimage.jpg"
    dim image_list as list

    image_list.initialize

    tempfolder = Starter.rp.GetSafeDirDefaultExternal("shared")
 
  
    Dim mp As MultipartFileData
    mp.Initialize
    mp.Dir = tempfolder
    mp.FileName = tempImageFile
    mp.KeyName = "file"
    mp.ContentType = "image/jpg"
    image_list.Initialize
    image_list.Add(mp)

   
    Dim jobupload As HttpJob
    jobupload.Initialize("",Me)
    jobupload.PostMultipart("yourwebsite.com/upload.php",NULL,image_list)
and in the php part

use the php code in this thread https://www.b4x.com/android/forum/threads/select-upload-display-delete-image-from-server.87438/
 
Top