nginx - IOS / Swift2 - List all files in remote directory -
i have server running nginx. have directory in server have several audio files. replaced real url "url".
how can list files in directory in table.
when print wecontent get:
403 forbidden
override func viewdidload() { super.viewdidload() let url = nsurl(string: "url")! //self.webview.loadrequest(nsurlrequest(url: url)) let task = nsurlsession.sharedsession().datataskwithurl(url) { (data, response, error) -> void in // happen when task completes if let urlcontent = data { let webcontent = nsstring(data: urlcontent, encoding: nsutf8stringencoding) print(webcontent) dispatch_async(dispatch_get_main_queue(), { () -> void in self.webview.loadhtmlstring(string(webcontent!), baseurl: nil) }) } else { // show error message } } task.resume() }
thank you
a 403 error means user or group doesn't have permission access resource requesting.
you should try changing permissions on directory trying access to: o+r or change owner of directory appropriate user. (i use apache servers, user www)
nginx provides it's own documentation on 403 errors here
Comments
Post a Comment