سؤال

I'm using ASIHTTP in my iOS app to download a queue of images. The problem is that under bad 3g connections sometimes the image download will fail and you will get a partially downloaded image (with the rest of the image being gray).

Now the question:

I'm getting from my webserver in the HTTP Headers the content-length value. Is this value going to be the correct size of the whole image, so I can verify against this the downloaded image, or if the connection is interrupted the content-lenght will only include the bytes that where downloaded at that moment, meaning I can't verify this way if the image was downloaded complete?

هل كانت مفيدة؟

المحلول

You might want to look at the answers posted for this question, usually it is indeed correct, otherwise it serves little purpose, however I'm not sure if it's as easy as comparing the two numbers after the download has finished, but it's probably reliable 99% of the time.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top