"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.
This commit is contained in:
parent
430d7618e1
commit
2183dbbbcc
1 changed files with 1 additions and 1 deletions
|
|
@ -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];
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue