ASIHTTP を使用してライブラリまたはカメラから画像をアップロードするにはどうすればよいですか?
NSString *post;
self.view.userInteractionEnabled = FALSE;
post = [NSString stringWithFormat:@" "];
NSData *postData = [post dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES];
NSString *urlString1 = [NSString stringWithFormat:/* [...] */];
NSString *postLength = [NSString stringWithFormat:@"%d", [postData length]];
NSURL *myWebserverURL = [NSURL URLWithString:urlString1];
NSMutableURLRequest *request1 = [[[NSMutableURLRequest alloc] init] autorelease];
[request1 setURL:myWebserverURL];
[request1 setHTTPMethod:@"POST"];
[request1 setValue:postLength forHTTPHeaderField:@"Content-Length"];
[request1 setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
[request1 setHTTPBody:postData];
connectionFlag = FALSE;
conn = [[NSURLConnection alloc] initWithRequest:request1 delegate:self];
if (conn){
receivedData = [[NSMutableData data] retain];
} else {
isValidation = FALSE;
NSLog(@"no data retrieved");
}
これは私がテキストフィールドに対して行ったことです