太强大了,2句代码完事。
var gcdWebUploader: GCDWebUploader!
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
self.gcdWebUploader = GCDWebUploader(uploadDirectory: NSHomeDirectory() + "/Documents/")
self.gcdWebUploader.start(withPort: 8097, bonjourName: "Web server")
}