ask: I want to upload an image to server .I know to convert image ti NSData and then send it to server but is there any way to send complete image from your bundle to server without byte conversion? If there is a way i will be thankful if someone provide me details about this

 

 

answer:

Any thing that has to be transferred over network has to be converted to byte stream. You will get the entire image as-is on the sever side, not sure what is the problem with that

 

NO you cannot send the image direct to the server because image url is not found. What you cando is convert yor image in data and then data in base 64 encoding string and send that string to the server You can do it like this:-

 NSData *imagedata=[NSData dataWithData:UIImagePNGRepresentation(*yourimagename*)];
    NSString *base64string=[imagedata base64EncodedString]; 

Send image like this:-

[request setPostValue:base64string forKey:@"image"];

 

another answer:

You can use base64 encoding and convert the image to string. The string can be passed on to server as POST/GET parameter. And on server side you can convert back to image. Base 64 encoding and decoding methods are available for both client and server side.