Get file size from web server

Looking for a way to get file size from web server using cocoa / foundation. I know it is possible to use NSURLconnection which will return an NSURLResponse that contains the file size. Is there any other way to get the size. I'm looking for a synchronous way to do this, so when I do [myClass getize] the size is returned.

thanks

+2


a source to share


1 answer


You can use NSMutableURLRequest

HEAD to send HTTP request (this is the method called setHTTPMethod

). You will get the same response headers as with GET, but you don't have to load the entire resource. And if you want to get the data synchronously use the sendSynchronousRequest…

method NSURLConnection

.



+4


a source







All Articles