Skip to content
Browse files

fixed issues with attachments

  • Loading branch information...
1 parent 134676d commit 2d2c63d4e4b85a72d9eee962d11be2f46805c1dc Jamie Pinkham committed Feb 4, 2011
Showing with 53 additions and 1 deletion.
  1. +1 −1 Categories/NSMutableURLRequest+Parameters.m
  2. +26 −0 OAAtachment.h
  3. +26 −0 OAAtachment.m
View
2 Categories/NSMutableURLRequest+Parameters.m
@@ -104,7 +104,7 @@ - (void)attachFileWithName:(NSString *)name filename:(NSString*)filename content
[bodyData appendData:[filePrefix dataUsingEncoding:NSUTF8StringEncoding]];
[bodyData appendData:data];
- [bodyData appendData:[[[@"--" stringByAppendingString:Boundary] stringByAppendingString:@"--"] dataUsingEncoding:NSUTF8StringEncoding]];
+ [bodyData appendData:[[[@"\r\n--" stringByAppendingString:Boundary] stringByAppendingString:@"--"] dataUsingEncoding:NSUTF8StringEncoding]];
[self setValue:[NSString stringWithFormat:@"%d", [bodyData length]] forHTTPHeaderField:@"Content-Length"];
[self setHTTPBody:bodyData];
[bodyData release];
View
26 OAAtachment.h
@@ -0,0 +1,26 @@
+//
+// OAAttachment.h
+// Zeus
+//
+// Created by Jamie Pinkham on 2/3/11.
+// Copyright 2011 Tumblr. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+
+
+@interface OAAttachment : NSObject {
+ NSString *name;
+ NSString *fileName;
+ NSString *contentType;
+ NSData *data;
+}
+
+@property (nonatomic, copy) NSString *name;
+@property (nonatomic, copy) NSString *fileName;
+@property (nonatomic, copy) NSString *contentType;
+@property (nonatomic, copy) NSData *data;
+
+- (id)initWithName:(NSString *)aName filename:(NSString *)aFilename contentType:(NSString *)aContentType data:(NSData *)aData;
+
+@end
View
26 OAAtachment.m
@@ -0,0 +1,26 @@
+//
+// OAAttachment.h
+// Zeus
+//
+// Created by Jamie Pinkham on 2/3/11.
+// Copyright 2011 Tumblr. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+
+
+@interface OAAttachment : NSObject {
+ NSString *name;
+ NSString *fileName;
+ NSString *contentType;
+ NSData *data;
+}
+
+@property (nonatomic, copy) NSString *name;
+@property (nonatomic, copy) NSString *fileName;
+@property (nonatomic, copy) NSString *contentType;
+@property (nonatomic, copy) NSData *data;
+
+- (id)initWithName:(NSString *)aName filename:(NSString *)aFilename contentType:(NSString *)aContentType data:(NSData *)aData;
+
+@end

0 comments on commit 2d2c63d

Please sign in to comment.
Something went wrong with that request. Please try again.