Skip to content
This repository was archived by the owner on Apr 24, 2020. It is now read-only.
This repository was archived by the owner on Apr 24, 2020. It is now read-only.

Post file and extra parameters #4

@olkarls

Description

@olkarls

Hi Ivan!

Thank you for the framework.

How can I add upload a file and additional parameters to the same request?

I've got the following code:

RFRequest *r = [RFRequest requestWithURL:[NSURL URLWithString:BASE_URL] type:RFRequestMethodPost bodyContentType:RFRequestBodyTypeMultiPartFormData resourcePathComponents:token, @"resource", nil];

NSString  *jpgPath = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents/tempImage.jpg"];    
[r addData:[NSData dataWithContentsOfFile:jpgPath] withContentType:@"image/jpeg" forKey:@"image.jpg"];

[r addParam:@"Some String" forKey:@"resource[string_value]"];
[r addParam:@"2012-06-10" forKey:@"resource[another_string_value]"];

Only one parameter is sent to the Rails API.

What am I missing?

Thanks

/ Ola

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions