http POST onwork not called frequently enough

Giganews Newsgroups
Subject: http POST onwork not called frequently enough
Posted by:  Jim (btree…@gmail.com)
Date: Fri, 29 Dec 2006

I'm using D6 w/Indy 10.x

The app uploads files (30 megs) to the server and works.  Because these are
BIG files, the OnworkBegin, OnWork, and OnWorkEnd ARE being set.  The
problem is during the upload, there are only 3 -5 calls being made to ALL
(no each) method.  The progress bar doesn't get updated enough.  How can I
get the progress bar to update more frequently?

Thanks
Jim

Stream := TIdMultipartFormDataStream.Create;
  try
  Stream.AddFormField('ucustomer',edCustomer.text);
  Stream.AddFile( 'ufile', L, 'multipart/form-data' );
  IdHTTP1.Post( 'http://www.mysite.com:8082/upload_ac.php', Stream );
  finally
    Stream.Free;
  end;
  lblStatus.Caption := 'finished';

procedure TfrmMain.IdHTTP1WorkBegin(ASender: TObject; AWorkMode: TWorkMode;
  AWorkCountMax: Integer);
begin
  if AWorkMode = wmWrite then
  begin
    ProgressBar.Position := 0;
    ProgressBar.Max := AWorkCountMax;
    Application.ProcessMessages;
  end;
end;

procedure TfrmMain.IdHTTP1Work(ASender: TObject; AWorkMode: TWorkMode;
  AWorkCount: Integer);
begin
  if AWorkMode = wmWrite then
  begin
    ProgressBar.Position := AWorkCount;
    Application.ProcessMessages;
  end;
end;

procedure TfrmMain.IdHTTP1WorkEnd(ASender: TObject; AWorkMode: TWorkMode);
begin
  if AWorkMode = wmWrite then
  begin
    Application.ProcessMessages;
  end;
end;

procedure TfrmMain.IdHTTP1Status(ASender: TObject;
  const AStatus: TIdStatus; const AStatusText: String);
begin
  lblStatus.Caption := AStatusText;
end;

Replies