In a project, i want to download mp3 files in a http page loaded in web view. Downloaded files could be opened by apps like phone drive or dropbox.
When user click to the link in web view it should download it to iphone.
In server side, mp3 files are located outside of webroot. So, the link for download is something like "download.php?id=554"
Anyone can help me on this subject ? I wonder is there a way to achieve this. Thanks
EDIT
I added this delegate
func webView(webView: UIWebView!, shouldStartLoadWithRequest request: NSURLRequest!, navigationType: UIWebViewNavigationType) -> Bool {
var urlm = request.URL.absoluteURL?.absoluteString
if urlm?.rangeOfString("filename") != nil{
print(urlm)
//code to download (I NEED IT TOO)
return false
}
return true
}
But still don't know how to download ?
SwiftHTTP (https://github.com/daltoniam/swiftHTTP) made it possible to me!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With