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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T03:40:17+00:00 2026-06-10T03:40:17+00:00

I used this method to POST an image to server before, but it’s a

  • 0

I used this method to POST an image to server before, but it’s a little complicated because I have to add header and boundary by myself. Yesterday I found a project called Resty – “A simple Objective-C HTTP client for iOS and Mac”. However, after reading all of its documents, I can’t find any method to upload an image file. Please help, thanks so much.

NSMutableDictionary *params = [NSMutableDictionary dictionary];
[params setObject:@"this is a title" forKey:@"title"];

// ***How can I add an image by Resty?***
[params setObject:UIImageJPEGRepresentation(self.image, 1.0) forKey:@"image"];

LRRestyClient *client = [LRResty client];
[client setUsername:userId password:userToken];
[client post:APIImageUrl payload:params withBlock:^(LRRestyResponse *response){
    NSLog(@"Done");
}];
  • 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-10T03:40:19+00:00Added an answer on June 10, 2026 at 3:40 am

    i think this framework not handle image data and custom parameters correctly you may follow this topic and create correct NSData format

    How to upload image and text using HTTP POST?

    or if you want more mature framework personally i advice restkit.
    in my project i send image to rest service with this sample code

     RKObjectManager *service = restkit_manager; //initialized previously
          [service loadObjectsAtResourcePath:@"/api/ChangeProfileImage" usingBlock:^(RKObjectLoader *loader) {
                loader.delegate      = self;
                loader.method        = RKRequestMethodPOST;
                loader.cachePolicy   = RKRequestCachePolicyNone;
                loader.objectMapping = (RKObjectMapping *) [service.mappingProvider mappingForKeyPath:MAPPING_PROFILE_IMAGE_UPDATE];
    
                NSMutableDictionary *params_dict = [NSMutableDictionary new];
    
               //custom parameters
               [params_dict setValue:UserKey forKey:@"UserKey"];
    
                RKParams *params = [RKParams paramsWithDictionary:params_dict];
                //encoded image
                [params setData:data MIMEType:@"image/png" forParam:@"FileName"];
    
                loader.params                = params;
                loader.serializationMIMEType = RKMIMETypeJSON;
            }];
    

    this slide may give idea http://www.slideshare.net/tkalapun/restfull-with-restkit

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a problem when call applet method from javascript.. I used this function
All, I have a method that returns a List. This method is used to
I was reading this answer and trying to copy the method used there, but
I have written a login form, in this I have used, form and method
SOLVED! Used this example from php.net post method handling multiple uploads, with the knowledge
I have a servlet which is used to display image.This servlet actually called by
Till this moment I used this method to invoke: public string AddText { set
public boolean requestRouteToHost (int networkType, int hostAddress) This method in ConnectivityManager if used with
So, let's say I've got a method like this, which is used to check
This is how I used to make method calls: SvcHelper.Using<SomeWebServiceClient>(proxy => { proxy.SomeMethod(); }

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.