UIImage * im = [UIImage imageWithContentsOfFile: path]; // obtain the image NSData * data = UIImagePNGRepresentation (im) through the path of the path ); // obtain image data/* There are two methods for obtaining images in ios: UIImageJPEGRepresentation, one is UIImagePNGRepresentation. The former obtains much smaller data than the latter .. */NSMutableData * imageData = [NSMutableData dataWithData: data]; // The setPostBody method of ASIFormDataRequest requires NSMutableData NSURL * url = [NSURL URLWithString: @ "server address"]; ASIFormDataRequest * aRequest = [[initalloc] initWithURL: url]; [aRequest setDelegate: self]; // proxy [aRequest setRequestMethod: @ "POST"]; [aRequest setPostBody: imageData]; [aRequest addRequestHeader: @ "Content-Type" value: @ "bin Ary/octet-stream "]; // The value here must be consistent with that on the server [aRequest startAsynchronous]; // start. Asynchronous [aRequest setDidFinishSelector: @ selector (headPortraitSuccess)]; // The headPortraitSuccess method is automatically triggered when the request succeeds [aRequest setDidFailSelector: @ selector (headPortraitFail)]; // if the request fails, the headPortraitFail method [aRequest release] is automatically triggered.