In the didRecieveResponse delegate method for the NSURLConnection you will recieve a response that contains such info. if and only if those has been set on server:
The following gets you the disk size of the image:
- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response
{
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
int state = [httpResponse statusCode];
if (state >= 400 && state <600)
{
// something wrong happen
}
NSLog(@"Download Response : %@", [response description]); // this shows all the info. available by server.
int file_size = [response expectedContentLength];
}
You can check for the size and then cancel the connection if you want to.
For image dimensions. check this question. the answer claims that
it can be done with the suggested fastimage category.
The only logical way to get this done is by downloading the first part of the image that contains the image header. which contains such an info as the image type(png, jpg ...) and the image dimensions. I believe that this library do so.