From 2183dbbbcc24cfc7800fbe924a5bb871a86b73a2 Mon Sep 17 00:00:00 2001 From: Michael Parker Date: Fri, 6 Jan 2012 21:24:45 -0800 Subject: [PATCH] "Content-disposition" should be "form-data" for a single file. The "Content-disposition" should only be "file" if one of multiple files in a subpart. See the end of http://www.w3.org/TR/html4/interact/forms.html, section 17.13.4, for details. AFNetworking does not currently support creation of subparts where "file" should be used. This fixes Tornado from failing to parse our file upload. --- AFNetworking/AFHTTPClient.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AFNetworking/AFHTTPClient.m b/AFNetworking/AFHTTPClient.m index dbb66b5..a48ae00 100644 --- a/AFNetworking/AFHTTPClient.m +++ b/AFNetworking/AFHTTPClient.m @@ -451,7 +451,7 @@ static inline NSString * AFMultipartFormFinalBoundary() { - (void)appendPartWithFileData:(NSData *)data name:(NSString *)name fileName:(NSString *)fileName mimeType:(NSString *)mimeType { NSMutableDictionary *mutableHeaders = [NSMutableDictionary dictionary]; - [mutableHeaders setValue:[NSString stringWithFormat:@"file; name=\"%@\"; filename=\"%@\"", name, fileName] forKey:@"Content-Disposition"]; + [mutableHeaders setValue:[NSString stringWithFormat:@"form-data; name=\"%@\"; filename=\"%@\"", name, fileName] forKey:@"Content-Disposition"]; [mutableHeaders setValue:mimeType forKey:@"Content-Type"]; [self appendPartWithHeaders:mutableHeaders body:data];