Since the length of the url is limited in size, I have to split the hex string , upload it in parts and merge the parts again on download.
Only the GET
method has a limited length which is 2048
characters and you are currently using the GET
method for your request.
This should be done with the POST
method with the help of the WWWForm
class.
Let's say you want to send the player's name
, age
and score
, We can encode it with the code below:
WWWForm form = new WWWForm();
form.AddField("name", "Charles");
form.AddField("age", 29);
form.AddField("scrore", 67);
Add the player's profile picture or array data of some kind?
byte[] bytes = playerProfilePic;
form.AddBinaryData("profilePic", bytes, "profilePic.png", "image/png");
or
form.AddBinaryData("profilePic", bytes);
Now, let's send this to the Server.
WWW connection = new WWW(url, form);
yield return connection;
That's it. You don't need to send this piece by piece with a for
loop.