开发者

After having downloaded a big files from HTTP how to check if it's ok?

开发者 https://www.devze.com 2023-02-11 10:43 出处:网络
Are there any way to send an http request to know开发者_开发问答 for example the md5 of a file?

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消