mirror of
https://github.com/swisspol/GCDWebServer.git
synced 2024-10-07 00:08:05 +08:00
Update README.md
This commit is contained in:
parent
35bf846ee7
commit
3f9aef4dd6
20
README.md
20
README.md
@ -24,7 +24,7 @@ Requirements:
|
||||
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
|
||||
#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
|
||||
========================
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user