Uploading large files with AFNetworking?

I'm working on an application that generates large files (100Mb +) that I would like to upload to a web server.

By loading the file into an NSData object that will kill the application due to memory usage (this is the only way I can see in the AFNetworking docs), is there any other way to send the file along with maybe 10 other field forms?

Thank you in advance

+3


source to share


3 answers


I believe you need to create an NSMutableURLRequest and set the HTTPBodyStream on it, as recommended here:

http://afnetworking.org/Documentation/Classes/AFHTTPClient.html#//api/name/multipartFormRequestWithMethod:path:parameters:constructingBodyWithBlock :



I haven't tried this way, but it looks like you probably have to compile the multipart upload format yourself in this case.

+1


source


+1


source


Uploading a large file using AFNetworking you need to use

- (NSMutableURLRequest *)multipartFormRequestWithMethod:(NSString *)method
                                                   path:(NSString *)path
                                             parameters:(NSDictionary *)parameters
                              constructingBodyWithBlock:(void (^)(id <AFMultipartFormData> "        formData))block;

      

of AFHttpClient

or you can check this link for your custom implementation for PostController:

http://developer.apple.com/library/ios/#samplecode/SimpleURLConnections/Introduction/Intro.html

0


source







All Articles