Yogesh Lolusare
Yogesh Lolusare

Reputation: 2212

Afnetworking 2.0 PUT image

  1. I am able to use put method of afnetworking 2.0 successfully for putting data.

    NSString* PUTURL = [NSString stringWithFormat:@"%@/updateestado/estado/%@/idJugador/%ld",BASEURl,[status urlEncodeUsingEncoding:NSUTF8StringEncoding],userId];

    NSLog(@"REG URL----%@",PUTURL);

    AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager]; [manager PUT:PUTURL parameters:nil success:^(AFHTTPRequestOperation *operation, id responseObject) { NSLog(@"JSON: %@", responseObject); [self.NET_Delegate DelegateUpdateStatusResponce:responseObject];

    } failure:^(AFHTTPRequestOperation *operation, NSError *error) { [self.NET_Delegate DelegateUpdateStatusError:error]; }];

    1. I am able to upload video successfully using post method.
    2. But The requirement for uploading image is using PUT enter image description here
    3. I followed the way given in Simple "PUT" file upload with AFNetworking but had two issues says multipartFormRequestWithMethod deprived & when trying the approach get 404 error.
    4. No reference for this on afnetworking doc in github.

    5. Query: I am working on uploading image using put first time, so i think i am missing some thing. Any reference or code samples to achieve this will be helpful. Thanks

Upvotes: 3

Views: 381

Answers (1)

trojanfoe
trojanfoe

Reputation: 122391

You are not uploading an image; but rather a URL of the image (note the url parameter).

Therefore you will need to upload the image to a 3rd party site and then post the link to whatever that service is.

It's impossible to upload an image using a PUT request so you must be missing something.

Upvotes: 3

Related Questions