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 6567143
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T14:18:04+00:00 2026-05-25T14:18:04+00:00

I want to send an image to a web server running .Net which is

  • 0

I want to send an image to a web server running .Net which is not Restful .

I have tried a lot of things to convert the image into string and then sending it.
Like using initWithData:encoding: and also tried it with converting the image data into base64encodedstring by the method given in this question

iPhone to MS SQL Image Data Type Conversion Question

But no luck.

Then I thought of looking on facebook api for uploading images on facebook wall.
Using this tutorial the image can be uploaded to facebook

http://www.raywenderlich.com/1626/how-to-post-to-a-users-wall-upload-photos-and-add-a-like-button-from-your-iphone-app

But the problem is, it is using asihttprequest to send the data on the facebook wall and I cannot see the raw data in the request will uploading the image . Can anyone help me out.

  • 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-25T14:18:05+00:00Added an answer on May 25, 2026 at 2:18 pm

    I tried it at my end. First I converted to base64encoding like this:

    NSString *str64;
    
            if(Image){
                NSData *imageData = UIImageJPEGRepresentation(Image,0.75);
                str64 = [imageData base64Encoding];
            } 
    

    Then I added into a dictionary and then added that dictionary into an array so that I can pass it as a JSON string in request’s body.

    NSMutableArray *ParaArray =[[NSMutableArray alloc]init];

        NSDictionary *ParaDictionary=[NSDictionary dictionaryWithObjectsAndKeys:
                                      [NSString stringWithFormat:@"%@",Userid], @"userid",
                                      [NSString stringWithFormat:@"%@",[Imagename URLEncodedString]], @"imagename",
                                      [NSString stringWithFormat:@"%@",DateNTime], @"datetime", 
                                      [NSString stringWithFormat:@"%@",ImageLocation], @"imagelocation",
                                      str64,@"image",
                                      nil]; // set the parameter
    
    
        [ParaArray addObject:ParaDictionary];
    

    There after using ASIFormDataRequest I sent the image to server using this snippet:

    ASIFormDataRequest *request = [[ASIFormDataRequest alloc] initWithURL:[NSURL URLWithString:urlString]];
    
        [request setPostValue:[ParaArray JSONRepresentation]  forKey:@"bulk_data"];
    
        //[ParaDictionary release];
        [ParaArray release];
    
        [request setTimeOutSeconds:20];
    
    
        [request startSynchronous];
    

    It worked fine for me. I hope it helps you as well.

    Data is passed in form of a string and we can directly use the base64Encoding methods by copy pasting them. Though you might know them still here they are:

    - (NSString *) base64Encoding {
    return [self base64EncodingWithLineLength:0];
    }
    
    - (NSString *) base64EncodingWithLineLength:(NSUInteger) lineLength {
    const unsigned char *bytes = [self bytes];
    NSMutableString *result = [NSMutableString stringWithCapacity:[self length]];
    unsigned long ixtext = 0;
    unsigned long lentext = [self length];
    long ctremaining = 0;
    unsigned char inbuf[3], outbuf[4];
    unsigned short i = 0;
    unsigned short charsonline = 0, ctcopy = 0;
    unsigned long ix = 0;
    
    while( YES ) {
        ctremaining = lentext - ixtext;
        if( ctremaining <= 0 ) break;
    
        for( i = 0; i < 3; i++ ) {
            ix = ixtext + i;
            if( ix < lentext ) inbuf[i] = bytes[ix];
            else inbuf [i] = 0;
        }
    
        outbuf [0] = (inbuf [0] & 0xFC) >> 2;
        outbuf [1] = ((inbuf [0] & 0x03) << 4) | ((inbuf [1] & 0xF0) >> 4);
        outbuf [2] = ((inbuf [1] & 0x0F) << 2) | ((inbuf [2] & 0xC0) >> 6);
        outbuf [3] = inbuf [2] & 0x3F;
        ctcopy = 4;
    
        switch( ctremaining ) {
            case 1:
                ctcopy = 2;
                break;
            case 2:
                ctcopy = 3;
                break;
        }
    
        for( i = 0; i < ctcopy; i++ )
            [result appendFormat:@"%c", encodingTable[outbuf[i]]];
    
        for( i = ctcopy; i < 4; i++ )
            [result appendString:@"="];
    
        ixtext += 3;
        charsonline += 4;
    
        if( lineLength > 0 ) {
            if( charsonline >= lineLength ) {
                charsonline = 0;
                [result appendString:@"\n"];
            }
        }
    }
    
    return [NSString stringWithString:result];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a web server which receives an image from a client and do
I want to send image data to the server, For that, I have appended
i want convert image into byte array in php.actually i am accessing web service
i want to have both an Apache and a Game Server to be reachable
I want to save an image to the database using SQLite. I send the
How can I know filename of ImageView image? I want to send it as
i have a requirement, i want to take URL of image from user and
I want to display an image from the web to a panel in another
I want to display an image from the web to a panel in another
I do have some image files(.png files) in document directory(iPhone). I am viewing web

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.