Android Question http post large files

alon

Active Member
Licensed User
Longtime User
hi ,
I am using http post to upload a file as base64 string.

now when I am trying so send a big set of files, i am getting an error: outof memory.

so i would like to know what is the best way to send a lot of files base64 with http post

tnanks
 

alon

Active Member
Licensed User
Longtime User
I did a search but i could not find what i was looking for.
i need to post large string with base64 files, and not to upload a file.

Thanks
 
Upvote 0

alon

Active Member
Licensed User
Longtime User
Are you sending the files to your server? Which format are you using? multipart?

I have a table of images in my db, and I am saving the images as base64 in a filed type TEXT.

and then I am posting the table as xml to my server.

before I am posting to the server, i am inserting the rows of the table to a string
,but after a few rows I am getting out of memory error.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Images can produce very large base64 strings.

You need to have a good reason to convert the images to base 64. Why not use jRDC2 and just send the images as blobs? Will work faster and better.

You can write the strings to a file and then send them with Job.PostFile. The file will not be loaded into memory. You might get memory problems in other places.
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
I suggest to change the server site script to support fileuploads and read the data from the file uploaded, convert the file to base64 on Serverside and store the value in DB then.

Generally speaking it is a mistake to put images into the db. You should store the filename in DB and the file itself on Disc (webspace).
 
Upvote 0

alon

Active Member
Licensed User
Longtime User
I suggest to change the server site script to support fileuploads and read the data from the file uploaded, convert the file to base64 on Serverside and store the value in DB then.

Generally speaking it is a mistake to put images into the db. You should store the filename in DB and the file itself on Disc (webspace).

my problem with that is that every pic is associate to record in the customer db.

and I am not just uploading a file ,I am sending with every file a few parameters of the record id which is apply to in the customer db.
 
Upvote 0
Top