Get File Size information of File Requested in Download
Is there a way to query the size of a file that was requested via http in objective c on iphone. I would like to find out file size 开发者_Go百科prior to data being sent back so I can write a simple Download Progress indicator. Your help is much appreciated. Tony
The download size is in the HTTP header "Content-Length"
If you're using NSURLConnection to do the download, you can implement connection:didReceiveResponse: in your delegate. When this method is called, you'll be passed an NSURLResponse object that you can call expectedContentLength on.
If you're not using NSURLConnection, you might want to give us a few more details.
精彩评论