Android Question Postfile OR Http Multipart Requests for Bitmaps?


Active Member
Licensed User
I am using PostString in B4A to send JSON Strings to servers. After some issues with url encoding this is all working well.

I am now trying to upload bitmap files from the tablet (stored in File.DirRootExternal) to the servers. So far I have been using PostFile ie


We can see something hitting the pages but struggling to interpret it at the server end. I am working with two different developers; one using and the other .asp. Both are having the same issues.

Should I forget PostFile and use the http.MultiPartPost...I have read a forum thread and it looks like I might get a bit more control like attaching Key/Value pairs to attach some information about the files, but it also looks far more complicated than Postfile?


Staff member
Licensed User
It really depends on what the server expects. PostFile create a POST request with the file data as the request payload. If your server is configured to handle it then it is indeed very simple. You can use standard url parameters with PostFile.

If your server only accepts multipart requests then you need to follow this link:


Active Member
Licensed User
Hi Lip.

I upload files to my webserver using httputils PostBytes method.

On the Server Side the Byte Array can then be handled with the following code and either saved to a database or the file system as required.

    Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
        Dim data() As Byte
        data = Request.BinaryRead(Request.TotalBytes)
        IO.File.WriteAllBytes("C:\PictureName.jpg", data)
    End Sub