views:

164

answers:

2

Hi There, 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 prior to data being sent back so I can write a simple Download Progress indicator. Your help is much appreciated. Tony

+4  A: 

The download size is in the HTTP header "Content-Length"

Kimvais
+1  A: 

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.

Dewayne Christensen