Hi guys.
I am running into the following issue.
Whenever I need to upload small files, everything is okay. Like 6k, 9k files, no problems there.
But when the files are bigger, a small portion is uploaded and then the upload just seems to die and timeout. I do not know what is going on. I tried several FTP locations that I know have different server software running, I tried different libraries to do this (Synapse and Codebot). Both with the exact -same- result.
It is just weird and I can't figure out what is going on. What am I missing here?
I created a quick and dirty example program as follows:
The codebot library is here:
https://github.com/sysrpl/Cross.Codebotunit Main;
{$mode objfpc}{$H+}
interface
uses
Classes,
SysUtils,
Forms,
Controls,
Graphics,
Dialogs,
ExtCtrls,
StdCtrls,
FileUtil,
codebot.Networking.Ftp,
codebot.System;
type
{ TForm1 }
TForm1 = class(TForm)
Button1: TButton;
Memo1: TMemo;
Panel1: TPanel;
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
FTPClient: TFtpClient;
procedure Progress(Sender: TObject; const Size, Transmitted: LargeWord);
public
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
{ TForm1 }
procedure TForm1.Button1Click(Sender: TObject);
var
FileList: TStringList;
i: Integer;
begin
FileList := TStringList.Create;
FindAllFiles(FileList,
'/location/on/your/disk',
'*', False);
Memo1.Lines.Clear;
Memo1.Lines.Add(FileList.Text);
FTPClient.Connect;
FTPClient.MakeDir('StorageFolder');
FTPClient.ChangeDir('StorageFolder');
for i := 0 to FileList.Count -1 do begin
Memo1.Lines.Add('Uploading file ' + ExtractFileName(FileList[i]));
FTPClient.FilePut(FileList[i], ExtractFileName(FileList[i]));
end;
FTPClient.Disconnect;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
FTPClient := TFTPClient.Create;
FTPClient.Host := 'hostname.domain.tld';
FTPClient.UserName := 'username';
FTPClient.Password := 'password';
FTPClient.OnProgress:=@Progress;
end;
procedure TForm1.Progress(Sender: TObject; const Size, Transmitted: LargeWord);
begin
Memo1.Lines.Add('Progress: ' + IntToStr(Transmitted) + '/' + IntToStr(Size));
end;
end.