Revised POSTing to images

Changes:
   - Copied function from sam’s iOS testing code

Confirmed with iOS
Note: iOS needs to handle errors