![]() |
![]() ![]() ![]() |
WinHTTP component.
|
function Upload(NumberOfFields: Word): Boolean; // returns False if busy
|
The Upload method starts HTTP request to upload data via HTTP protocol, using multipart/form-data POST method, introduced in RFC 1867.
|
|
Before starting the uploading, it requests fields and their names which should be uploaded using OnUploadFieldRequest event. To specify number of fields which should be uploaded pass it in NumberOfFields parameter (this specifies how many times the OnUploadFieldRequest should be triggered to request another piece of data).
|
|
After requesting the data required to build HTTP request, it starts it with multipart/form-data Content Type in the HTTP header and constantly trigger OnUploadProgress event after each data block with size specified in TransferBufferSize property.
|
procedure TForm1.UploadBtnClick(Sender: TObject);
|
begin
|
WinHTTP1.Upload(2); // upload 2 files
|
{ To specify the data which should uploaded use OnUploadFieldRequest event }
|
end;
|
![]() |
|
Check out also OnUploadFieldRequest topic for more detailed description on how to upload data.
|
UploadByFieldNames method;
|
OnUploadFieldRequest and OnUploadProgress events;
|
Read, Abort methods and TransferBufferSize property.
|