[PHP] How to verify the file after the FTP transfer???

2004-12-17 Thread Scott Fletcher
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...

Thanks,
 Scott

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



Re: [PHP] How to verify the file after the FTP transfer???

2004-12-17 Thread Richard Davey
Hello Scott,

Friday, December 17, 2004, 4:26:46 PM, you wrote:

SF As for the FTP, I decided to do the Exec() for transfering and
SF verifying. Now the only thing left is to verify it. I welcome your
SF suggestion and thought on this...

Perform an ls/dir on the FTP server once it has completed - if the
file is there and is the right file size, it obviously worked :)

Best regards,

Richard Davey
-- 
 http://www.launchcode.co.uk - PHP Development Services
 I am not young enough to know everything. - Oscar Wilde

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



Re: [PHP] How to verify the file after the FTP transfer???

2004-12-17 Thread Richard Lynch
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