开发者

Get File Size information of File Requested in Download

开发者 https://www.devze.com 2022-12-17 05:13 出处:网络
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 D

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消