Re: How to verify the file after the FTP transfer???

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Scott Fletcher wrote:
> Hi!  I'm now stuck on how to verify the file after the FTP transfer.  I'm
> writing a script that do the files and database backup and verifying them.
> I'm using the Unix machine.  Since I'm using the tar utility via the shell
> environment in PHP, like PassThru() or Exec().  I'm using the tar utility
> via Exec() for backing up and verifying because it have a lot of tar's
> options that I can use.  As for the FTP, I decided to do the Exec() for
> transfering and verifying.   Now the only thing left is to verify it.  I
> welcome your suggestion and thought on this...

Your first crude check is to see if the LENGTH of the file is what it
should be.

All your code should be checking that.

There are some built-in tar consistency checks you could run on the
uploaded file to see if tar thinks it's still kosher -- These are not
exhaustive nor would you want to claim that it was a "for sure" good
transfer just because tar thinks the file is okay.

You could also create "signatures" of files on each side, and compare the
signatures.  There are a number of possible algorithms to choose from for
the signature, but http://php.net/md5 should be an easy one.  That leaves
a 1 in 2 billion chance that the files are not the same.

If 1 in 2 billion isn't good enough odds, you *could* go so far as to
transfer the file *BACK* to the original server, with a different name,
and then exec("diff $original $copy") to see if they are the same.  Of
course, this could give a false negative if the transfer *back* was no
good, but the first transfer was actually kosher.

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux