画像、動画、音声ファイルをサーバーにアップロードしたい。同様のトピックに関するこのスレッドを読みましたが、コードの流れを完全に理解できませんでした。最初にサンプル コードまたはチュートリアルを提案していただければ幸いです。次のコードを使用して、メディアなしでサーバーに接続しています
[UIApplication sharedApplication].networkActivityIndicatorVisible = YES;
NSString *url =[[NSString alloc]initWithFormat:@"%@",[NetworkConstants getURL]];
NSURL *theURL =[NSURL URLWithString:url];
[url release];
NSMutableURLRequest *theRequest =[NSMutableURLRequest requestWithURL:theURL cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:0.0f];
[theRequest setHTTPMethod:@"POST"];
NSString *theBodyString = [NSString stringWithFormat:@"json1=%@&userID=%@",jsonObject,[GlobalConstants getUID]];
NSData *theBodyData = [theBodyString dataUsingEncoding:NSUTF8StringEncoding];
[theRequest setHTTPBody:theBodyData];
NSURLConnection *conn = [[NSURLConnection alloc] initWithRequest:theRequest delegate:self];
if (conn) {
NSLog(@"Successful in sending sync");
}
else {
NSLog(@"Failed Connection in sending sync");
}
[conn release];
コードのこの部分を編集して何かできれば、とても便利です。
どんな形の助けでも大歓迎です。
前もって感謝します!!