Re: [twsocket] ICSFTP delete file after transfer completed.

2016-01-28 Thread MMG Admin
Thank you for pointing me into the right direction!

2016-01-28 14:09 GMT+02:00 Angus Robertson - Magenta Systems Ltd <
an...@magsys.co.uk>:

> > I want to delete a file after succesfully uploading to ftp.
> > I use overbyteicsftp client and the following code:
> > Is this the correct approach to delete the file after complete
> > transfer to ftp?
>
> > if icsFtp.Put then begin
> >   if DeleteFile(nume_fisier) then
>
> In a crude program, you can get away with this.  But there is a risk
> the FTP server may have reported the upload successful when only a
> partial file was received, or not received atall.
>
> It's much safer to actually check the file exists after being uploaded
> and is the correct size and maybe has not been corrupted during upload,
> perhaps by running a CRC32 or MD5 check.
>
> How you check a file depends on the FTP server functionality, the best
> ways are using the MLST or MDTM commands, but you may need to use LIST
> if these are not supported.
>
> I suggest you look at the FtpCheckFile function in TMagFtp at:
>
> http://www.magsys.co.uk/delphi/magxfer.asp
>
> Or just use that component which has extensive error handling.
>
> Angus
>
>
> --
> To unsubscribe or change your settings for TWSocket mailing list
> please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
> Visit our website at http://www.overbyte.be
>
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] ICSFTP delete file after transfer completed.

2016-01-28 Thread Angus Robertson - Magenta Systems Ltd
> I want to delete a file after succesfully uploading to ftp.
> I use overbyteicsftp client and the following code:
> Is this the correct approach to delete the file after complete 
> transfer to ftp?

> if icsFtp.Put then begin
>   if DeleteFile(nume_fisier) then 

In a crude program, you can get away with this.  But there is a risk
the FTP server may have reported the upload successful when only a
partial file was received, or not received atall.  

It's much safer to actually check the file exists after being uploaded
and is the correct size and maybe has not been corrupted during upload,
perhaps by running a CRC32 or MD5 check.  

How you check a file depends on the FTP server functionality, the best
ways are using the MLST or MDTM commands, but you may need to use LIST
if these are not supported.  

I suggest you look at the FtpCheckFile function in TMagFtp at:
 
http://www.magsys.co.uk/delphi/magxfer.asp 

Or just use that component which has extensive error handling.

Angus


-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be