0
votes

I am trying to upload a image onto server's database.

For that I have done

  1. Converted image to nsdata using UIImageJPEGReprenstation.
  2. Converted nsdata to nstring using base64lib.

Problem here is that nsstring that I have is NSASCII encoded.

So the default open ssl converters are not able to read the file and convert it into correct images on server side.

So what i need is

The nsstring that I have created from nsdata must not be encoded using nsascii or nsutf8 or something, as the image data is binary.

Or

On server side i must decode the data back to binary from nsascii or whatever way I have encoded on client side. But here the issue is I do not have any inbuilt api for ascii decoding.

1
This question doesn't make sense. You say you base64'd the binary data so you can put it into a string. The output of base64 is a subset of ASCII, so naturally the string would end up being encoded as ASCII. What exactly is the problem? You just need to un-base64 it on the server. - Icydog
Problem is when I decoded textual data on server it gets decoded properly but the binary data I guess is getting double encoded and is not getting decoded properly. - Amol Ghotankar

1 Answers

0
votes

Why do you need to convert the image data to string data? Couldn't you just do an HTTP POST with jpg data (MIME image/jpeg)? This post shows you how to do it.