Multi-Part HTTP Request through xcode
        Posted  
        
            by 
                devsri
            
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by devsri
        
        
        
        Published on 2011-03-08T08:20:24Z
        Indexed on 
            2011/03/09
            8:10 UTC
        
        
        Read the original article
        Hit count: 295
        
Hello Everyone,
i want to upload image,video and audio files to a server. I have read this thread on the similar topic but wasn't able to understand completely the flow of the code. It would be great if you can suggest me some sample code or tutorial to start with. I am using the following code to connect without any media to the server
[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];
It would be really convenient for me if anything could be done editing this part of code.
Any form of help would be highly appreciated.
Thanks in advance!!
© Stack Overflow or respective owner