title: Error Domain=NSCocoaErrorDomain Code=3840 "Invalid value around character 0." UserInfo={NSDebugDescription=Invalid value around character 0.}
body: <p>I am trying to upload image by converting image to base64 format. And i am getting below error.</p>
  
  <blockquote>
    <p>Error Domain=NSCocoaErrorDomain Code=3840 "Invalid value around character 0." UserInfo={NSDebugDescription=Invalid value around character 0.}</p>
  </blockquote>
  
  <p>Please refer my code</p>
  
  <pre><code>NSData *imageData = UIImagePNGRepresentation(image);
  NSString *imageDataString = [imageData base64EncodedString];
  </code></pre>
  
  <p>Here is the Post request method</p>
  
  <pre><code>- (id) postRequest:(NSURL *)postURL postString:(NSString *)postString 
  {
      NSError * error=nil;
      NSURLResponse * urlResponse;
      NSData *myRequestData = [ NSData dataWithBytes: [ postString UTF8String ] length: [ postString length ]];
      NSMutableURLRequest * request =[[NSMutableURLRequest alloc]initWithURL:postURL cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:10];
      [request setHTTPBody: myRequestData];
      [request setHTTPMethod:@"POST"];
      [request setValue:@"application/json; charset=utf-8" forHTTPHeaderField:@"Content-Type"];
  
      NSData * data =[NSURLConnection sendSynchronousRequest:request returningResponse:&amp;urlResponse error:&amp;error];
      if (!data)
      {
          return nil;
      }
  
      id jsonnResponse =[NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingAllowFragments error:&amp;error];
      return jsonnResponse;
  }
  </code></pre>