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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T06:41:06+00:00 2026-06-10T06:41:06+00:00

I suppose it is pretty simple but I couldn’t figure out how to do

  • 0

I suppose it is pretty simple but I couldn’t figure out how to do it. I want to upload a file to using a PUT request to a webservice using AFNetworking library. This is the curl command I used to test the service

mac:~ user$ curl --verbose -T image.jpeg http://server.org:8001/social/test.jpg
* About to connect() to server.org port 8001 (#0)
*   Trying 123.45.123.123...
* connected
* Connected to server.org (123.45.123.123) port 8001 (#0)
> PUT /social/test.jpg HTTP/1.1
> User-Agent: curl/7.24.0 (x86_64-apple-darwin12.0) libcurl/7.24.0 OpenSSL/0.9.8r zlib/1.2.5
> Host: server.org:8001
> Accept: */*
> Content-Length: 78341
> Expect: 100-continue
> 
< HTTP/1.1 100 CONTINUE
< Server: cx1193719-b
< Content-Type: Text/Html
< Accept-Ranges: bytes
< Content-Length: 0
* We are completely uploaded and fine
< HTTP/1.1 200 OK
< Server: cx1193719-b
< Content-Type: Text/Html
< Accept-Ranges: bytes
< Content-Length: 0
< 
* Connection #0 to host server.org left intact
* Closing connection #0

I’ve been able to upload file using POST and form data to other web services, I have used PUT requests (with AFHTTPClient and putPath) but still I don’t understand how to do that simple file upload.

Thanks for your help!

  • 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-10T06:41:08+00:00Added an answer on June 10, 2026 at 6:41 am

    This is part of the AFNetworking FAQ. Check the https://github.com/AFNetworking/AFNetworking/wiki/AFNetworking-FAQ.

    Also if you are using a subclass of AFHTTPClient you might want to extend it with something similar to:

    - (void)putPath:(NSString *)path
         parameters:(NSDictionary *)parameters
               data:(NSData*)data
            success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success
            failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure;
    

    as suggested in this answer: https://stackoverflow.com/a/9014768/634940.

    With that implemented and your AFHTTPClient subclass’ base URL set to http://server.org you can go ahead and call:

    NSData *imageData = [NSData dataWithContentsOfFile:pathToYourJPEGFile];
    [client putPath:@"social/test.jpg"
         parameters:nil
               data:imageData
            success:yourSuccessBlock
            failure:yourFailureBlock];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This should be pretty simple but it's not working. I have a file underneath
I have a pretty simple idea in mind but don't exactly know how to
Pretty simple question, suppose my app will be installed as myApp +-- bin +--
Okay, I'm pretty sure I'm missing something very obvious here, but I just couldn't
Don't freak out about the length of my post, it's pretty simple, I just
Suppose I have an c++ code (see below for a simple example). I want
Suppose I have a simple model, such as Record: @Model public class Record {
Suppose I created index with descending order CREATE INDEX `MyTable.MyIndex` USING BTREE ON `MyTable`
Ok I know this is pretty broad, but let me narrow it down a
Suppose: 2D array: abcdef ghijkl mnopqr Stored in simple string of length width *

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.