FTP Code Example: Resume an upload
The StartByte property contains a zero-based index in both RemoteFile and LocalFile that determines the point where the transmission of data starts from. Once set, the StartByte index is used for all future downloads/uploads. The property must be reset to "0" for normal downloads/uploads. The code below demonstrates how this property can be used to resume an upload.
Note that FileSize is an action property. When queried it will ask the server for the size of the file specified by the RemoteFile property.C#
ftp.LocalFile = @"C:\LocalFile.txt"; ftp.RemoteFile = "RemoteFile.txt"; ftp.StartByte = ftp.FileSize.ToString(); ftp.Upload(); ftp.StartByte = "0";
ftp.setLocalFile("C:\\LocalFile.txt"); ftp.setRemoteFile("RemoteFile.txt"); ftp.setStartByte(String.valueOf(ftp.getFileSize())); ftp.upload(); ftp.setStartByte("0");
We appreciate your feedback. If you have any questions, comments, or suggestions about this article please contact our support team at firstname.lastname@example.org.