I am trying so much to upload the image and video with other data But not success how can I do that .
My app is like that i have take data from the sqlite database and I want to that data which i am gettig from the sqlite .And for image have only the url .
Before that I done sync with the normal data .But image and video i have no idea how can do that .
For sync or uploading data i done code
Like this
-(void)sendRequest
{
NSDate* date = [NSDate date];
//Create the dateformatter object
NSDateFormatter* formatter = [[[NSDateFormatter alloc] init] autorelease];
//Set the required date format
[formatter setDateFormat:@"dd-MMM-yyyy"];
//Get the string date
NSString* str = [formatter stringFromDate:date];
NSString *post = [NSString stringWithFormat:@"Token=%@&LocationID=%@&JourneyID=%@&Altitude=%@&Longitude=%@&Latitude=%@&Speed=%@&Accuracy=%@&LocationDate=%@&LastSyncDate=%@",tokenapi,Location_ID,Journey_jlID,Altitude_jl,Longitude_jl,Latitude_jl,Speed_jl,Accuracy_jl,LocationDate_jl,str];
NSLog(@"%@",post);
NSData *postData = [post dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES];
postLength = [NSString stringWithFormat:@"%d", [postData length]];
NSLog(@"%@",postLength);
NSMutableURLRequest *request = [[[NSMutableURLRequest alloc] init]autorelease];
[request setURL:[NSURL URLWithString:@"http://www.google.com?RequestType=UserJourneyLocation&Command=NEW"]];
NSLog(@"%@",request);
[request setHTTPMethod:@"POST"];
[request setValue:postLength forHTTPHeaderField:@"Content-Length"];
[request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
[request setHTTPBody:postData];
NSURLConnection *theConnection = [[NSURLConnection alloc] initWithRequest:request delegate:self];
if (theConnection) {
webData = [[NSMutableData data] retain];
NSLog(@"%@",webData);
}
}
But how can send the multiple data to server with image and video data
Please try this to post the data on server.