Page 1 of 1
md5_file via ftp connection
Posted: Thu Mar 19, 2009 6:33 am
by SidewinderX
I need to download a file using the ftp functions. However, I need to verify the files integrity. Is there a way, when I connect to the remote server, I can generate an md5 hash of the file (before the transfer so I can compare it to another md5 hash after the transfer)?
Re: md5_file via ftp connection
Posted: Thu Mar 19, 2009 10:49 am
by William
Unless the FTP server allows this you're going to have to download it, check the md5, and then decide if you want to keep it or not.
Re: md5_file via ftp connection
Posted: Thu Mar 19, 2009 11:06 am
by John Cartwright
I think normal FTP clients compare the last modified timestamp and the filesize.
Re: md5_file via ftp connection
Posted: Thu Mar 19, 2009 11:51 am
by panic!
Off topic but
John, I reckon your signature could be:
Code: Select all
if ($toBe || !$toBe) echo 'That is the question';
Re: md5_file via ftp connection
Posted: Thu Mar 19, 2009 11:58 am
by John Cartwright
//continues offtopic
John, I reckon your signature could be:
I guess it depends how you read it out in your mind. I'm on the fence with this one!

Re: md5_file via ftp connection
Posted: Thu Mar 19, 2009 1:19 pm
by crazycoders
I don't know of any FTP commands from the standard FTP RFC file that talks about generating a MD5sum of a file on the fly. This is usually done by the submitter of the file, he uploads the file in the same directory of the file he submitted and then you as a user have to download both the original file and .md5 file and compare the CAT(*.md5) to md5sum() of the file you downloaded.