It,s my first time trying to send Images & Data to a PHP Server from an app, and I am quite confused as to what's the best way to achieve this.
In my research, I came across AFNetworking library and this base64 library (which I would take suggestion in another one), but I don't know if I can achieve what I want with that or how to implement it.
What I want to do is to send data & images that have a relationship.
Lets say the User
has to upload their user details + their picture
and their house details + a picture
my JSON
would be something like
{
"userDetails": { "name":"jon",
"surname":"smith",
"phone":"123412",
"userPic":"base64pic"
},
"house": { "address":"123 asd",
"postcode":"w2 e23",
"housePic":"base64pic"
}
}
of course that JSON
would also have to include security validations.
My problem comes when I would like to avoid using base64
encoding given the 33% size increase and I don't know how I could send the same information to PHP.
I get very confused when trying to send images & data that have a relationship and should be stored taking that relationship into account in the server.
Basically What I am looking for is a way to send the same information but not base64 encoded images
but keeping the relationship in the data and trying to send as fewer request as possible. Is it possible? if so How?