Update README.md

This commit is contained in:
Pierre-Olivier Latour 2014-03-29 19:42:40 -07:00
parent 35bf846ee7
commit 3f9aef4dd6

View File

@ -24,7 +24,7 @@ Requirements:
Hello World Hello World
=========== ===========
This code snippet shows how to implement a custom HTTP server that runs on port 8080 and returns a "Hello World" HTML page to any request — Because GCDWebServer uses GCD blocks to handle requests, no subclassing or delegates are needed: This code snippet shows how to implement a custom HTTP server that runs on port 8080 and returns a "Hello World" HTML page to any request — since GCDWebServer uses GCD blocks to handle requests, no subclassing or delegates are needed:
```objectivec ```objectivec
#import "GCDWebServer.h" #import "GCDWebServer.h"
@ -55,6 +55,24 @@ int main(int argc, const char* argv[]) {
} }
``` ```
Adding File Upload & Download to iOS Apps
=========================================
GCDWebUploader is a subclass of GCDWebServer that provides an HTML 5 file uploader & downloader. This lets users upload, download and delete files from a directory inside your iOS app's sandbox using their web browser.
Simply instantiate and run a GCDWebUploader instance then visit http://{YOUR-IOS-DEVICE-IP-ADDRESS}/ from your web browser:
```objectivec
#import "GCDWebUploader.h"
- (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions {
NSString* documentsPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) firstObject];
GCDWebUploader* webUploader = [[GCDWebUploader alloc] initWithUploadDirectory:documentsPath];
[webUploader start];
return YES;
}
```
Serving a Static Website Serving a Static Website
======================== ========================