Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
7.8k views
in Java FTP by (240 points)


We basically want to validate whether we have successfully uploaded the file before trying to rename it or place new completion file. For this below is purposing solution can we implement them in FTP/FTPS/SFTP

1) By comparing the sizes of files available locally and the one uploaded.
2) By validating the header & trailer of the uploaded file, if both are present only then we can be sure that file upload is successful.

IF there is another mechanism which can tell about the file uploaded successfully please share also.

Kindly update me as soon as possible.

Thanks,
Abid

[color=blue]
[/color]

7 Answers

0 votes
by (162k points)
For FTP and FTPS, edtFTPj/PRO supports automatic validation via 1) the CRC of the files (if the server supports XCRC, e.g. CompleteFTP), or 2) via the file size.

This is via the setTransferIntegrityCheck() method. This isn't available (yet) for SFTP.
0 votes
by (240 points)
Thanks for your reply and sorry for late reply. Bruce can you please give me an example of CRC ? It would be so nice thanking in anticipation...

For FTP and FTPS, edtFTPj/PRO supports automatic validation via 1) the CRC of the files (if the server supports XCRC, e.g. CompleteFTP), or 2) via the file size.

This is via the setTransferIntegrityCheck() method. This isn't available (yet) for SFTP.
0 votes
by (162k points)
This is what a CRC is

http://en.wikipedia.org/wiki/Cyclic_redundancy_check

basically a hash that uniquely identifies a file. So if the hash on the client side matches the hash on the server side, you know you have the identical file.

Some servers support a command called XCRC which returns the hash on the server side.
0 votes
by (240 points)
Thanks a lot for your kind information, does com.enterprisedt.net.ftp.ssl.SSLFTPClient and com.enterprisedt.net.ftp.FileTransferClient automatically do the CRC in the back end for us or we have to configure it in some ways if we have to configure it that how to configure it.

This is what a CRC is

http://en.wikipedia.org/wiki/Cyclic_redundancy_check

basically a hash that uniquely identifies a file. So if the hash on the client side matches the hash on the server side, you know you have the identical file.

Some servers support a command called XCRC which returns the hash on the server side.
0 votes
by (162k points)
If (and it's a big if) XCRC is supported by the server, SSLFTPClient and ProFTPClient calculate the CRC locally and compare it to the CRC returned from the server.

Only supported for FTPS and FTP, not SFTP, via setTransferIntegrityCheck(true).

If XCRC is not supported the size is used instead.
0 votes
by (240 points)
Thanks a lot there is one problem setTransferIntegrityCheck(true) is not supported in com.enterprisedt.net.ftp.FileTransferClient and I am using com.enterprisedt.net.ftp.FileTransferClient for implementation. For using above method I have to change my code to convert com.enterprisedt.net.ftp.FileTransferClient to ProFtpClient.

Moreover comparing size of local file and remote file will not guarantee because getting file size using FTP,SFTP or FTP can vary due to different operating system. So what if I am using windows and the ftp server is using mac etc i think we will get wrong size information we can not use it as it's not a good parameter to judge, is it so dear ?

Thanks for your nice cooperation.
Abid



If (and it's a big if) XCRC is supported by the server, SSLFTPClient and ProFTPClient calculate the CRC locally and compare it to the CRC returned from the server.

Only supported for FTPS and FTP, not SFTP, via setTransferIntegrityCheck(true).

If XCRC is not supported the size is used instead.
0 votes
by (162k points)
Using the size isn't ideal, but if XCRC isn't supported, you don't have too many other options. However the size will always be the same no matter what protocol is used.

Categories

...