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

Discussion in 'Android Questions' started by Alberto Michelis, Jul 2, 2019.

  1. Alberto Michelis

    Alberto Michelis Active 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?
     
  2. José J. Aguilar

    José J. Aguilar Well-Known Member Licensed User

  3. ronell

    ronell Well-Known Member Licensed User

    this is how i upload images on my webserver

    B4A Code
    Code:
    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/
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice