Declared in AFHTTPClient.h

Overview

The AFMultipartFormData protocol defines the methods supported by the parameter in the block argument of multipartFormRequestWithMethod:path:parameters:constructingBodyWithBlock:.

Tasks

  • – appendPartWithHeaders:body:

    Appends HTTP headers, followed by the encoded data and the multipart form boundary.

    required method
  • – appendPartWithFormData:name:

    Appends the HTTP headers Content-Disposition: form-data; name=#{name}", followed by the encoded data and the multipart form boundary.

    required method
  • – appendPartWithFileData:name:fileName:mimeType:

    Appends the HTTP header Content-Disposition: file; filename=#{filename}; name=#{name}" and Content-Type: #{mimeType}, followed by the encoded file data and the multipart form boundary.

    required method
  • – appendPartWithFileURL:name:error:

    Appends the HTTP header Content-Disposition: file; filename=#{generated filename}; name=#{name}" and Content-Type: #{generated mimeType}, followed by the encoded file data and the multipart form boundary.

    required method
  • – appendData:

    Appends encoded data to the form data.

    required method
  • – appendString:

    Appends a string to the form data.

    required method

Instance Methods

appendData:

Appends encoded data to the form data.

- (void)appendData:(NSData *)data

Parameters

data

The data to be encoded and appended to the form data.

Discussion

Appends encoded data to the form data.

Declared In

AFHTTPClient.h

appendPartWithFileData:name:fileName:mimeType:

Appends the HTTP header Content-Disposition: file; filename=#{filename}; name=#{name}" and Content-Type: #{mimeType}, followed by the encoded file data and the multipart form boundary.

- (void)appendPartWithFileData:(NSData *)data name:(NSString *)name fileName:(NSString *)fileName mimeType:(NSString *)mimeType

Parameters

data

The data to be encoded and appended to the form data.

name

The name to be associated with the specified data. This parameter must not be nil.

mimeType

The MIME type of the specified data. (For example, the MIME type for a JPEG image is image/jpeg.) For a list of valid MIME types, see http://www.iana.org/assignments/media-types/. This parameter must not be nil.

filename

The filename to be associated with the specified data. This parameter must not be nil.

Discussion

Appends the HTTP header Content-Disposition: file; filename=#{filename}; name=#{name}" and Content-Type: #{mimeType}, followed by the encoded file data and the multipart form boundary.

Declared In

AFHTTPClient.h

appendPartWithFileURL:name:error:

Appends the HTTP header Content-Disposition: file; filename=#{generated filename}; name=#{name}" and Content-Type: #{generated mimeType}, followed by the encoded file data and the multipart form boundary.

- (BOOL)appendPartWithFileURL:(NSURL *)fileURL name:(NSString *)name error:(NSError **)error

Parameters

fileURL

The URL corresponding to the file whose content will be appended to the form.

name

The name to be associated with the specified data. This parameter must not be nil.

error

If an error occurs, upon return contains an NSError object that describes the problem.

Return Value

YES if the file data was successfully appended, otherwise NO.

@discussion The filename and MIME type for this data in the form will be automatically generated, using NSURLResponse -suggestedFilename and -MIMEType, respectively.

Discussion

Appends the HTTP header Content-Disposition: file; filename=#{generated filename}; name=#{name}" and Content-Type: #{generated mimeType}, followed by the encoded file data and the multipart form boundary.

Declared In

AFHTTPClient.h

appendPartWithFormData:name:

Appends the HTTP headers Content-Disposition: form-data; name=#{name}", followed by the encoded data and the multipart form boundary.

- (void)appendPartWithFormData:(NSData *)data name:(NSString *)name

Parameters

data

The data to be encoded and appended to the form data.

name

The name to be associated with the specified data. This parameter must not be nil.

Discussion

Appends the HTTP headers Content-Disposition: form-data; name=#{name}", followed by the encoded data and the multipart form boundary.

Declared In

AFHTTPClient.h

appendPartWithHeaders:body:

Appends HTTP headers, followed by the encoded data and the multipart form boundary.

- (void)appendPartWithHeaders:(NSDictionary *)headers body:(NSData *)body

Parameters

headers

The HTTP headers to be appended to the form data.

body

The data to be encoded and appended to the form data.

Discussion

Appends HTTP headers, followed by the encoded data and the multipart form boundary.

Declared In

AFHTTPClient.h

appendString:

Appends a string to the form data.

- (void)appendString:(NSString *)string

Parameters

string

The string to be encoded and appended to the form data.

Discussion

Appends a string to the form data.

Declared In

AFHTTPClient.h