Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6604945
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T19:13:27+00:00 2026-05-25T19:13:27+00:00

I am try to sync or upload the data on the remote server from

  • 0

I am try to sync or upload the data on the remote server from iPhone but not getting it. I try this from 1 week but didn’t succeed.
How can solve this. I am using the NSURLConnection methods or any one give idea on
ASIHTTPRequest method but I am new for ASIHTTPRequest. I need this method only for this code:

- (void)sendRequestforContent
{   
    //this for finding the date of sync on the server
    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];

    NSError *error = nil; 

    NSHTTPURLResponse *response = nil; 
    NSMutableData *postBody = [NSMutableData data];
    NSURL *url = [NSURL URLWithString:@"http://www.google.com"]; 

    NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url]; 

    NSString *boundary = @"-------------------a9d8vyb89089dy70"; 

    NSString *contentType = [NSString stringWithFormat:@"multipart/form-data; boundary=%@", boundary]; 

    [request setHTTPMethod:@"POST"]; 

    [request setValue:contentType forHTTPHeaderField:@"Content-Type"];

    [postBody appendData:[[NSString stringWithFormat:@"--%@\r\n", boundary] dataUsingEncoding:NSUTF8StringEncoding]]; 

    //this is for TOKEN_API
    [postBody appendData:[@"Content-disposition: form-data; name=\"Token\"\r\n\r\n" dataUsingEncoding:NSUTF8StringEncoding]]; 

    [postBody appendData:[tokenapi dataUsingEncoding:NSUTF8StringEncoding]]; 

    [postBody appendData:[[NSString stringWithFormat:@"\r\n--%@\r\n", boundary] dataUsingEncoding:NSUTF8StringEncoding]]; 

    //this for the CONTENT_ID
    [postBody appendData:[@"Content-disposition: form-data; name=\"contentID\"\r\n\r\n" dataUsingEncoding:NSUTF8StringEncoding]]; 

    [postBody appendData:[content_id dataUsingEncoding:NSUTF8StringEncoding]]; 

    [postBody appendData:[[NSString stringWithFormat:@"\r\n--%@\r\n", boundary] dataUsingEncoding:NSUTF8StringEncoding]];

    //this for the CONTENTTYPE_ID
    [postBody appendData:[@"Content-disposition: form-data; name=\"contentTypeID\"\r\n\r\n" dataUsingEncoding:NSUTF8StringEncoding]]; 
    NSString *ContentTypeString = [NSString stringWithFormat:@"%d",content_type];
    [postBody appendData:[ContentTypeString dataUsingEncoding:NSUTF8StringEncoding]]; 

    [postBody appendData:[[NSString stringWithFormat:@"\r\n--%@\r\n", boundary] dataUsingEncoding:NSUTF8StringEncoding]];


    //this for the CONTENT_Location_Id
    [postBody appendData:[@"Content-disposition: form-data; name=\"contentLocationID\"\r\n\r\n" dataUsingEncoding:NSUTF8StringEncoding]]; 

    [postBody appendData:[contenLocation_id dataUsingEncoding:NSUTF8StringEncoding]]; 

    [postBody appendData:[[NSString stringWithFormat:@"\r\n--%@\r\n", boundary] dataUsingEncoding:NSUTF8StringEncoding]];


    //this is for the User_Caption
    [postBody appendData:[@"Content-disposition: form-data; name=\"userCaption\"\r\n\r\n" dataUsingEncoding:NSUTF8StringEncoding]]; 

    [postBody appendData:[user_caption dataUsingEncoding:NSUTF8StringEncoding]]; 

    [postBody appendData:[[NSString stringWithFormat:@"\r\n--%@\r\n", boundary] dataUsingEncoding:NSUTF8StringEncoding]];


    //this is for the User_Comment
    [postBody appendData:[@"Content-disposition: form-data; name=\"userComment\"\r\n\r\n" dataUsingEncoding:NSUTF8StringEncoding]]; 

    [postBody appendData:[user_comment dataUsingEncoding:NSUTF8StringEncoding]]; 

    [postBody appendData:[[NSString stringWithFormat:@"\r\n--%@\r\n", boundary] dataUsingEncoding:NSUTF8StringEncoding]];



    //this for the Tags
    [postBody appendData:[@"Content-disposition: form-data; name=\"tags\"\r\n\r\n" dataUsingEncoding:NSUTF8StringEncoding]]; 

    [postBody appendData:[tag dataUsingEncoding:NSUTF8StringEncoding]]; 

    [postBody appendData:[[NSString stringWithFormat:@"\r\n--%@\r\n", boundary] dataUsingEncoding:NSUTF8StringEncoding]];


    //this for the Date_Record
    [postBody appendData:[@"Content-disposition: form-data; name=\"dateRecorded\"\r\n\r\n" dataUsingEncoding:NSUTF8StringEncoding]]; 

    [postBody appendData:[date_recorded dataUsingEncoding:NSUTF8StringEncoding]]; 

    [postBody appendData:[[NSString stringWithFormat:@"\r\n--%@\r\n", boundary] dataUsingEncoding:NSUTF8StringEncoding]];

    //this for the image_data
    [postBody appendData:[[NSString stringWithFormat:@"Content-disposition: form-data; name=\"image_file\"; filename=\"%@\"\r\n",@"image.jpg"] dataUsingEncoding:NSUTF8StringEncoding]];

    [postBody appendData:[@"Content-Type: image/jpg\r\n\r\n" dataUsingEncoding:NSUTF8StringEncoding]];

    [postBody appendData:image];

    [postBody appendData:[[NSString stringWithFormat:@"\r\n--%@--\r\n",boundary] dataUsingEncoding:NSUTF8StringEncoding]];



    //this for the Share_type
    [postBody appendData:[@"Content-disposition: form-data; name=\"shareType\"\r\n\r\n" dataUsingEncoding:NSUTF8StringEncoding]]; 
    NSString *ShareString = [NSString stringWithFormat:@"%d",share_type];
    [postBody appendData:[ShareString dataUsingEncoding:NSUTF8StringEncoding]]; 

    [postBody appendData:[[NSString stringWithFormat:@"\r\n--%@\r\n", boundary] dataUsingEncoding:NSUTF8StringEncoding]];

    //this for the Views
    [postBody appendData:[@"Content-disposition: form-data; name=\"views\"\r\n\r\n" dataUsingEncoding:NSUTF8StringEncoding]]; 
     NSString *ViewsString = [NSString stringWithFormat:@"%d",views];
    [postBody appendData:[ViewsString dataUsingEncoding:NSUTF8StringEncoding]]; 

    [postBody appendData:[[NSString stringWithFormat:@"\r\n--%@\r\n", boundary] dataUsingEncoding:NSUTF8StringEncoding]];


    //this for the PLAY_time
    [postBody appendData:[@"Content-disposition: form-data; name=\"playTime\"\r\n\r\n" dataUsingEncoding:NSUTF8StringEncoding]]; 
    NSString *TimeString = [NSString stringWithFormat:@"%d",play_time];
    [postBody appendData:[TimeString dataUsingEncoding:NSUTF8StringEncoding]]; 

    [postBody appendData:[[NSString stringWithFormat:@"\r\n--%@\r\n", boundary] dataUsingEncoding:NSUTF8StringEncoding]];


    //this for the Posted_By
    [postBody appendData:[@"Content-disposition: form-data; name=\"postedBy\"\r\n\r\n" dataUsingEncoding:NSUTF8StringEncoding]]; 
    [postBody appendData:[postred_by dataUsingEncoding:NSUTF8StringEncoding]]; 


    //this for the AVG_Rating
    [postBody appendData:[[NSString stringWithFormat:@"\r\n--%@\r\n", boundary] dataUsingEncoding:NSUTF8StringEncoding]];

    [postBody appendData:[@"Content-disposition: form-data; name=\"avgRating\"\r\n\r\n" dataUsingEncoding:NSUTF8StringEncoding]]; 
    NSString *AvgString = [NSString stringWithFormat:@"%d",avg_rating];
    [postBody appendData:[AvgString dataUsingEncoding:NSUTF8StringEncoding]]; 

    [postBody appendData:[[NSString stringWithFormat:@"\r\n--%@\r\n", boundary] dataUsingEncoding:NSUTF8StringEncoding]];


    [postBody appendData:[@"Content-disposition: form-data; name=\"LastSyncDate\"\r\n\r\n" dataUsingEncoding:NSUTF8StringEncoding]]; 
    [postBody appendData:[str dataUsingEncoding:NSUTF8StringEncoding]]; 

    [postBody appendData:[[NSString stringWithFormat:@"\r\n--%@\r\n", boundary] dataUsingEncoding:NSUTF8StringEncoding]];


    [request setHTTPBody:postBody];

    NSData *shoutData = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error];

    NSString *returnString = [[NSString alloc] initWithData:shoutData encoding:NSUTF8StringEncoding];
    NSLog(@"%@", returnString);
}

It is not going into the this methods

- (void)connectionDidFinishLoading:(NSURLConnection *)connection 
{      
    loginStatus = [[NSString alloc] initWithBytes: [webData mutableBytes] length:[webData length] encoding:NSUTF8StringEncoding]; 
    NSLog(@"%@", loginStatus);  
} 

It show me HTML page on console.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T19:13:28+00:00Added an answer on May 25, 2026 at 7:13 pm
    NSString *urlString = [[NSString alloc] initWithString:@"http://192.168.0.1:96/JourneyMapperAPI?RequestType=Content&Command=New"];
    NSURL *url = [[NSURL alloc] initWithString:urlString];
    
    NSMutableData *postBody;//Here comes your data that you have created in the question
    NSString *msgLength = [[NSString alloc] initWithFormat:@"%d", [postBody length]];//use either [postBody length] or [postBody bytes], I am not sure about it
    
    ASIFormDataRequest *serverRequest = [ASIFormDataRequest requestWithURL:url];
    [serverRequest addRequestHeader:@"Content-Type" value:@"text/xml; charset=utf-8"];
    [serverRequest addRequestHeader:@"Content-Length" value:msgLength];
    [serverRequest appendPostData:postBody];
    [serverRequest setDelegate:self];
    [serverRequest setDidFinishSelector:@selector(sendAlertsRequestDone:)];
    [serverRequest setDidFailSelector:@selector(sendAlertsRequestWentWrong:)];
    [serverRequest setUploadProgressDelegate:progressView];// here progressView is UIProgressbar
    [serverRequest startAsynchronous];
    
    [urlString release];
    [url release];
    [postBody release];
    [msgLength release];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

when I download file i want progressbar sync with this. but not, my code
I have this code for update: public Boolean update() { try { data.put(ContactsContract.Groups.SHOULD_SYNC, true);
This is difficult for me to put right but let me try. I have
I'm getting this error when I try to pass a task to a Celery
How can I sync local and remote folders using rsync from inside a php
i try to sync a local diretory to a remote system with rsync (cwrsync
I have the code from struct import pack self.data = {'SYNC' : 0x16, 'SOH'
Try loading this normal .jpg file in Internet Explorer 6.0. I get an error
Try to see which cast is faster (not necessary better): new c++ case or
When i try to save data to fields in my UserProfile Django raises an

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.