0

I am using following code to get bytes array. thx to this post.

Data *data = [NSData dataWithContentsOfFile:filePath];
NSUInteger len = [data length];
Byte *byteData = (Byte*)malloc(len);
memcpy(byteData, [data bytes], len);

it is the right method to do so?

Now, How i can pass bytes array into url?

Thank You for Help,

Community
  • 1
  • 1

1 Answers1

0

You're using the right method to extract the raw bytes from the data. To get those into a URL, you'll need to convert them to a string. Exactly what string depends on the format that you're submitting (ie. it could be just a list of 1s and 0s, or YES and NO, or any other character(s) as required by the server you're talking to.)

Ben Gottlieb
  • 85,404
  • 22
  • 176
  • 172
  • Hey thank you Ben, But i have large data to send that's y i am converting into bytes, any idea how can i do it? –  Dec 25 '09 at 10:02
  • Without knowing what the server is expecting, there's no way to answer this question. – Ben Gottlieb Dec 25 '09 at 11:48
  • Ban, We have ASP.net SOAP based service. server expecting two parameters from iphone or client side. i.e.FileName & FileData (In byte array). Using these we uploading the file on server. Thank You. –  Dec 25 '09 at 12:33