mirror of
https://github.com/swisspol/GCDWebServer.git
synced 2026-05-13 00:02:02 +08:00
Update README.md
This commit is contained in:
@@ -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
|
||||
========================
|
||||
|
||||
|
||||
Reference in New Issue
Block a user