Are there any way to send an http request to know开发者_开发问答 for example the md5 of a file?
I need it because I have a php script that downloads a remote file from http and then writes it locally.
I would like to check if it was transfered right.
Thanks
HTTP (in reality TCP) has internal error checking, so everything you download ist correct. The only problem you can have is an incomplete download, so check for filesize.
Without checksum at original server, either external or inside file (like .exe), you can't. HTTP provides no such functionality.
This isn't efficient, but you could download it twice and checksum each (with md5 or sha). If the two match, and the size matches the content-length header, it's probably correct.
精彩评论