Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pyke369/PKMultipartInputStream
an NSInputStream subclass suitable for building multipart/form-data http requests bodies in MacOSX/iOS applications.
https://github.com/pyke369/PKMultipartInputStream
Last synced: about 1 month ago
JSON representation
an NSInputStream subclass suitable for building multipart/form-data http requests bodies in MacOSX/iOS applications.
- Host: GitHub
- URL: https://github.com/pyke369/PKMultipartInputStream
- Owner: pyke369
- License: mit
- Created: 2010-10-19T12:27:55.000Z (about 14 years ago)
- Default Branch: master
- Last Pushed: 2018-05-07T08:28:10.000Z (over 6 years ago)
- Last Synced: 2024-10-20T05:13:19.342Z (about 2 months ago)
- Language: Objective-C
- Homepage: http://github.com/pyke369/PKMultipartInputStream
- Size: 2.18 MB
- Stars: 73
- Watchers: 4
- Forks: 19
- Open Issues: 2
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Awesome Lists containing this project
- awesome - PKMultipartInputStream - An NSInputStream subclass suitable for building multipart/form-data HTTP requests bodies in MacOSX/iOS applications. (etc)
- awesome - PKMultipartInputStream - An NSInputStream subclass suitable for building multipart/form-data HTTP requests bodies in MacOSX/iOS applications. (etc)
README
######################
PKMultipartInputStream
######################This NSInputStream subclass is suitable for building multipart/form-data HTTP requests bodies in MacOSX/iOS applications.
=====
Usage
=====A very simple example is presented below::
PKMultipartInputStream *body = [[PKMultipartInputStream alloc] init];
[body addPartWithName:@"string" string:@"value"];
[body addPartWithName:@"data" data:[NSData dataWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"image" ofType:@"png"]]];
[body addPartWithName:@"file" path:[[NSBundle mainBundle] pathForResource:@"video" ofType:@"mp4"]];NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"http://site.com/upload.php"]];
[request setValue:[NSString stringWithFormat:@"multipart/form-data; boundary=%@", [body boundary]] forHTTPHeaderField:@"Content-Type"];
[request setValue:[NSString stringWithFormat:@"%d", [body length]] forHTTPHeaderField:@"Content-Length"];
[request setHTTPBodyStream:body];
[request setHTTPMethod:@"POST"];
[[NSURLConnection alloc] initWithRequest:request delegate:self];An example iOS application is provided along with the class code, please refer to it.