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

  • Home
  • SEARCH
  • 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 7738111
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T08:10:43+00:00 2026-06-01T08:10:43+00:00

Hi friends, I am trying to get the string data and image data from

  • 0

Hi friends,

I am trying to get the string data and image data from a url.but the string data

displays null.And any one tell me how to upload the image to the specified url.

here i am writing this code

UIImage *image = [UIImage  imageWithData: [NSData dataWithContentsOfURL:[NSURL URLWithString:@"http://192.168.1.105:9966/PC/DisplayImage?id=2"]]];

myimages.image=image;
NSURL *url = [ NSURL URLWithString: [ NSString stringWithFormat:@"http://192.168.1.105:9966/PC/DisplayImage?id=2"] ]; 
NSData *imageData = UIImageJPEGRepresentation(image, 90);
NSString *encodedImage = [Base64 encode:imageData];
NSLog(@"my encoding image is %@",encodedImage);
NSURL *url = [ NSURL URLWithString: [ NSString stringWithFormat: @"http://192.168.1.105:9966/PC/DisplayImage?id=2"] ]; 
NSString *test = [NSString stringWithContentsOfURL:url];
NSLog(@"naveenkumar testing%@",test);
  • 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-06-01T08:10:45+00:00Added an answer on June 1, 2026 at 8:10 am

    You can use NSURLConnection for uploading image by using post method –

    NSURL *postURL = [NSURL URLWithString:[NSString stringWithFormat:@"%@submit.php",@"http://x.com/"]]; 
    
        NSMutableURLRequest *postRequest = [NSMutableURLRequest requestWithURL:postURL
                                                                   cachePolicy:NSURLRequestUseProtocolCachePolicy
                                                               timeoutInterval:30.0];
    
        // change type to POST (default is GET)
        [postRequest setHTTPMethod:@"POST"];
    
        NSMutableData *postBody = [NSMutableData data];
    
    
        // just some random text that will never occur in the body
        NSString *stringBoundary = @"0xKhTmLbOuNdArY---This_Is_ThE_BoUnDaRyy---pqo";
        // header value
        NSString *headerBoundary = [NSString stringWithFormat:@"multipart/form-data; boundary=%@",
                                    stringBoundary];
        // set header
        [postRequest addValue:headerBoundary forHTTPHeaderField:@"Content-Type"];
    // image ------------
    
            [postBody appendData:[[NSString stringWithFormat:@"--%@\r\n", stringBoundary] dataUsingEncoding:NSUTF8StringEncoding]];
            [postBody appendData:[@"Content-Disposition: form-data; name=\"text\"; filename=\"frontimage.png\"\r\n" dataUsingEncoding:NSUTF8StringEncoding]];
            [postBody appendData:[@"Content-Type: image/png\r\n" dataUsingEncoding:NSUTF8StringEncoding]];
            [postBody appendData:[@"Content-Transfer-Encoding: binary\r\n\r\n" dataUsingEncoding:NSUTF8StringEncoding]];
            // add it to body
    
            [postBody appendData:UIImageJPEGRepresentation(image, 90)];
            [postBody appendData:[@"\r\n" dataUsingEncoding:NSUTF8StringEncoding]];
    // final boundary
    
        [postBody appendData:[[NSString stringWithFormat:@"--%@\r\n", stringBoundary] dataUsingEncoding:NSUTF8StringEncoding]];
    
    
        // add body to post
        [postRequest setHTTPBody:postBody];
    
        NSURLConnection *theConnection = [NSURLConnection connectionWithRequest:postRequest delegate:self];
    
        if (theConnection) 
            NSLog(@"%@",theConnection);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Actually i was trying to get data from elgg database based on multiple joins.
I am trying to get the list of specific user`s friends from twitter. This
im trying to rewitre from this URL... /Search/VehicleDetails.aspx?vehicle=285584 to this one /VehicleAdvert/tella/Friend/285584 so far
I'm trying to get a list of user's friends using fb connect for the
I am trying to invoke an internal method from a dynamically generated one. The
Friends, I want to match a string like int lnum[]; so I am trying
I am trying to get the names of my friends using FB Graph API
I am trying to sort array/lists/whatever of data based upon the unicode string values
I'm trying to loop results from a php script into my jquery friends list.
Hello all my friends, I am trying to send a long string through socket

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.