|
@@ -134,6 +134,7 @@
|
134
|
134
|
{
|
135
|
135
|
NSString * name = [field valueForKey:@"name"];
|
136
|
136
|
NSString * content = [field valueForKey:@"data"];
|
|
137
|
+ NSString * contentType = [field valueForKey:@"type"];
|
137
|
138
|
// field is a text field
|
138
|
139
|
if([field valueForKey:@"filename"] == nil || content == [NSNull null]) {
|
139
|
140
|
[formData appendData:[[NSString stringWithFormat:@"--%@\r\n", boundary] dataUsingEncoding:NSUTF8StringEncoding]];
|
|
@@ -155,7 +156,7 @@
|
155
|
156
|
NSString * filename = [field valueForKey:@"filename"];
|
156
|
157
|
[formData appendData:[[NSString stringWithFormat:@"--%@\r\n", boundary] dataUsingEncoding:NSUTF8StringEncoding]];
|
157
|
158
|
[formData appendData:[[NSString stringWithFormat:@"Content-Disposition: form-data; name=\"%@\"; filename=\"%@\"\r\n", name, filename] dataUsingEncoding:NSUTF8StringEncoding]];
|
158
|
|
- [formData appendData:[[NSString stringWithFormat:@"Content-Type: application/octet-stream\r\n\r\n"] dataUsingEncoding:NSUTF8StringEncoding]];
|
|
159
|
+ [formData appendData:[[NSString stringWithFormat:@"Content-Type: %@\r\n\r\n", contentType] dataUsingEncoding:NSUTF8StringEncoding]];
|
159
|
160
|
[formData appendData:content];
|
160
|
161
|
[formData appendData:[[NSString stringWithFormat:@"\r\n"] dataUsingEncoding:NSUTF8StringEncoding]];
|
161
|
162
|
i++;
|
|
@@ -174,7 +175,7 @@
|
174
|
175
|
NSString * filename = [field valueForKey:@"filename"];
|
175
|
176
|
[formData appendData:[[NSString stringWithFormat:@"--%@\r\n", boundary] dataUsingEncoding:NSUTF8StringEncoding]];
|
176
|
177
|
[formData appendData:[[NSString stringWithFormat:@"Content-Disposition: form-data; name=\"%@\"; filename=\"%@\"\r\n", name, filename] dataUsingEncoding:NSUTF8StringEncoding]];
|
177
|
|
- [formData appendData:[[NSString stringWithFormat:@"Content-Type: application/octet-stream\r\n\r\n"] dataUsingEncoding:NSUTF8StringEncoding]];
|
|
178
|
+ [formData appendData:[[NSString stringWithFormat:@"Content-Type: %@\r\n\r\n", contentType] dataUsingEncoding:NSUTF8StringEncoding]];
|
178
|
179
|
[formData appendData:blobData];
|
179
|
180
|
[formData appendData:[[NSString stringWithFormat:@"\r\n"] dataUsingEncoding:NSUTF8StringEncoding]];
|
180
|
181
|
}
|
|
@@ -192,4 +193,4 @@
|
192
|
193
|
}
|
193
|
194
|
|
194
|
195
|
|
195
|
|
-@end
|
|
196
|
+@end
|