title: Sending Images and data to PHP server-side
body: <p>It,s my first time trying to send Images &amp; Data to a PHP Server from an app, and I am quite confused as to what's the best way to achieve this. </p>
  
  <p>In my research, I came across <a href="https://github.com/AFNetworking/AFNetworking/wiki/Getting-Started-with-AFNetworking" rel="nofollow">AFNetworking</a> library and <a href="http://cocoadev.com/wiki/BaseSixtyFour" rel="nofollow">this base64</a> 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.</p>
  
  <p>What I want to do is to send data &amp; images that have a relationship.</p>
  
  <p>Lets say the <code>User</code> has to upload their <code>user details + their picture</code> and their <code>house details + a picture</code>
  my <code>JSON</code> would be something like </p>
  
  <pre><code>{
      "userDetails": { "name":"jon",
                    "surname":"smith",
                    "phone":"123412",
                    "userPic":"base64pic"
                  },
      "house": { "address":"123 asd",
                 "postcode":"w2 e23",
                 "housePic":"base64pic"
              }
  
  }
  </code></pre>
  
  <p>of course that <code>JSON</code> would also have to include security validations.</p>
  
  <p>My problem comes when I would like to avoid using <code>base64</code> encoding given the 33% size increase and I don't know how I could send the same information to PHP.</p>
  
  <p>I get very confused when trying to send images &amp; data that have a relationship and should be stored taking that relationship into account in the server.</p>
  
  <p>Basically What I am looking for is a way to send the same information but not <code>base64 encoded images</code> but keeping the relationship in the data and trying to send as fewer request as possible. Is it possible? if so How?</p>