B4J Question HTTP PostOutputStream ?

Similar threads

B4A Code Snippet [B4X] Bytes To File
B4A Tutorial [B4X] OkHttpUtils2 with Wait For
B4A Tutorial [B4X] AsyncStreams Tutorial
B4J Code Snippet Redirect the output to a file
B4J Tutorial Consuming http streams
B4A Code Snippet [B4X] DownloadAndSave

wl

Well-Known Member
Licensed User
Hi,

I want to upload a (potentially) large set of bytes from a client (B4J and B4I) to a B4J http server.

So far I found that a PostBytes method, but it seems this requires a byte array. So I guess the entire set of bytes should be in memory before uploading.
If I would use a PostFile I would first need to store the bytes in a local file.

Isn't there something like a PostOutputStream, so that I can use a stream to write the bytes to be uploaded to ?

I would need such a thing both for uploading from an iOS device as well as a B4J client.

Thanks
 

wl

Well-Known Member
Licensed User
The intention is to write an iOS app to upload movies and pictures from the iPhone to the server. When a user would upload a large 4K video ...

But note that I would need to add a header (first X bytes) to it: so the stream would be

headerbytes+bytes of the movie

Currently I create a new file with this contents (so that the movie temporarily takes twice the space on the device) so this second file can be uploaded...

Ideally I am not taking the file in memory (RAM usage) nor create a second file (storage usage), but send the stream...
 
Top