Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

ProgressBar for Upload with TIdHTTP

CInFeverCInFever Member Posts: 4
Ok, I'm wanting to have a progress bar as I upload.
I'm trying to use OnWork, BeginOnWork, and EndOnWork.
But I get the errors:
[code][BCC32 Error] Unit1.cpp(71): E2316 '_fastcall TForm1::IdHTTP1Work(TObject *,TWorkMode,const int)' is not a member of 'TForm1'
[BCC32 Error] Unit1.cpp(79): E2316 '_fastcall TForm1::IdHTTP1WorkBegin(TObject *,TWorkMode,const int)' is not a member of 'TForm1'
[BCC32 Error] Unit1.cpp(85): E2316 '_fastcall TForm1::IdHTTP1WorkEnd(TObject *,TWorkMode)' is not a member of 'TForm1'[/code]

Here's my code so far:
[code]void __fastcall TForm1::Button2Click(TObject *Sender)
{
TIdMultiPartFormDataStream *FormData = new TIdMultiPartFormDataStream;
TStringStream *Response = new TStringStream("");

if(OpenDialog1->Execute()) {
try {
FormData->AddFile("userfile", OpenDialog1->FileName, GetMIMETypeFromFile(OpenDialog1->FileName));
FormData->AddFormField("upload", "Uploading...");
Form1->IdHTTP1->Request->Referer = "http://www.xxxxxxxx.com/";
Form1->IdHTTP1->Post("http://hostingxx.xxxxxxxxx.com/xxxxx.php", FormData, Response);
Form1->Memo1->Text = Response->DataString;
}
__finally
{
delete FormData;
delete Response;
}
}
}

//---------------------------------------------------------------------------

void __fastcall TForm1::IdHTTP1Work(TObject *Sender, TWorkMode AWorkMode,
const int AWorkCount)
{
ProgressBar1->Position=AWorkCount;
Application->ProcessMessages();
}
//---------------------------------------------------------------------------

void __fastcall TForm1::IdHTTP1WorkBegin(TObject *Sender,
TWorkMode AWorkMode, const int AWorkCountMax)
{
ProgressBar1->Max= AWorkCountMax;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::IdHTTP1WorkEnd(TObject *Sender,
TWorkMode AWorkMode)
{
ProgressBar1->Position=0;
}
//---------------------------------------------------------------------------[/code]
Thank You.
Sign In or Register to comment.