B4J Question Upload files from your B4J app to your B4J server over the internet

cklester

Well-Known Member
Licensed User
For my app, the client has a local KVS. I want to upload the KVS and store it on the server, so it looks like the proper way is to B4XSerializator the KVS and send it up.

The serialized KVS will be stored in a MySQL database (already set up and functioning properly).

Is there a sample client code module similar to [Server] Upload files from your B4A app to your B4J server over the internet but for a B4J client? I don't have B4A at the moment.

I did a search for "b4j file client," which did not seem to have any relevant code, and B4XSerializator, which had a ton of results, none of which I could determine were relevant (but I'm sure there are some relevant hits there--I just don't know what to look for.)

(If anyone wants to suggest an alternate/better approach, I'm all ears!)
 

cklester

Well-Known Member
Licensed User
Just create a HttpJob and use PostBytes or PostFile to send the file.

I tried using both of those (PostBytes and PostFile), but I'm trying to send a session_id along with it. I can't figure out how to send a file while also posting a session_id (so the server knows what to do with the file). How can I accomplish that?
 
Upvote 0

cklester

Well-Known Member
Licensed User
OK, I've read up a little bit more on all of this, and thanks to @aeric , I believe I can just send the session identifier (or authorized API key, basically) in the header, and then use PostBytes() to send the object to the server.

The data I'm wanting to send, right now, is a tiny amount. Might be between 10Kb and 50Kb for now. I will make it future-proof, in case things go wild and they need to store more. So, for now, I'd like to store the "file" directly in the MySQL database. I'm amenable. :)
 
Upvote 0
Top