Android Question image into imageview to web, format base64

ivanomonti

Expert
Licensed User
Longtime User
I need to save the picture included in a imageview sending php to the same binary base64, but I've never done this with B4A
 

ivanomonti

Expert
Licensed User
Longtime User
B4X:
    Dim a,q,d,v,link As String
    link = "http://humanequality.ddns.net:8888/cgi/panel/humanequalityapiweb.php"
   
    a = "post_new_pocheparole"
    d = "False"
    q = ""
    v = xtitle & "," & xcontent & "," & xautor & "," & xidautor & "," & ximage & "," & xdatetime)
   
    Private http As HttpJob
    http.Initialize(a,Me)
    http.Download2(link, Array As String("a",a,"q",q,"d",d,"v",v))


There is some limitation in length string in use httputilities 2 if you send parameters base64 variable length

XImage is a base64 of images that can range from 300.00 to 800.00 kb

Thank 10000
 
Upvote 0

ivanomonti

Expert
Licensed User
Longtime User
The limit is not in HttpUtils2. It is in http itself. You should use POST instead of GET.

but I removed the base64 string and everything is working, I assume that it is the string that becomes huge,,, I speak also to use post instead of get, but I can not find where to send the function parameters in the library
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
I speak also to use post instead of get
See my signature (file upload b4a->php) for an example. The point is that you need to use a "Multipart Post Request".

And btw for my example to use you dont need to base64 encode a file to send it. It is using the normal http way to transport a form together with some values. in one call. On php-side you just need to work with the data the right way (php-file included in example)
 
Last edited:
Upvote 0
Top