diff --git a/src/common/mac/HTTPMultipartUpload.h b/src/common/mac/HTTPMultipartUpload.h index 8de32b49..ce9956f0 100644 --- a/src/common/mac/HTTPMultipartUpload.h +++ b/src/common/mac/HTTPMultipartUpload.h @@ -38,7 +38,7 @@ @protected NSURL *url_; // The destination URL (STRONG) NSDictionary *parameters_; // The key/value pairs for sending data (STRONG) - NSMutableArray *files_; // Array of NSDictionaries file/name (STRONG) + NSMutableDictionary *files_; // Dictionary of name/file-path (STRONG) NSString *boundary_; // The boundary string (STRONG) NSHTTPURLResponse *response_; // The response from the send (STRONG) } @@ -51,7 +51,7 @@ - (NSDictionary *)parameters; - (void)addFileAtPath:(NSString *)path name:(NSString *)name; -- (NSArray *)files; +- (NSDictionary *)files; // Set the data and return the response - (NSData *)send:(NSError **)error; diff --git a/src/common/mac/HTTPMultipartUpload.m b/src/common/mac/HTTPMultipartUpload.m index e91cd0af..623bde6f 100644 --- a/src/common/mac/HTTPMultipartUpload.m +++ b/src/common/mac/HTTPMultipartUpload.m @@ -120,13 +120,13 @@ //============================================================================= - (void)addFileAtPath:(NSString *)path name:(NSString *)name { if (!files_) - files_ = [[NSMutableArray alloc] init]; + files_ = [[NSMutableDictionary alloc] init]; - [files_ addObject:[NSDictionary dictionaryWithObject:name forKey:path]]; + [files_ setObject:path forKey:name]; } //============================================================================= -- (NSArray *)files { +- (NSDictionary *)files { return files_; } @@ -151,11 +151,11 @@ } // Add any files to the message - count = [files_ count]; + NSArray *fileNames = [files_ allKeys]; + count = [fileNames count]; for (i = 0; i < count; ++i) { - NSDictionary *dict = [files_ objectAtIndex:i]; - NSString *file = [[dict allKeys] objectAtIndex:0]; - NSString *name = [dict objectForKey:file]; + NSString *name = [fileNames objectAtIndex:i]; + NSString *file = [files_ objectForKey:name]; [postBody appendData:[self formDataForFile:file name:name]]; }