The unit Unit1;
Interface
USES the
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Idhttp, URLMon IdMultipartFormData StdCtrls;
Const UpUrl='http://17.6.1.99:8888/11/1.asp'.
Const UpFileName='d: \ 123. Doc;
Type
TForm1=class (TForm)
For: TButton;
Procedure Button1Click (Sender: TObject);
Private
{Private declarations}
Public
{Public declarations}
end;
Var
Form1: TForm1;
Implementation
{$R *. DFM}
Procedure TForm1. Button1Click (Sender: TObject);
Var
MutPartForm: TIdMultiPartFormDataStream;
Response: the string;
FHttp: Tidhttp;
The begin
FHttp:=Tidhttp. Create (nil);
FHttp. HandleRedirects:=true;
FHttp. AllowCookies:=true;
MutPartForm:=TIdMultiPartFormDataStream. Create;
MutPartForm. AddFormField (' the act ', 'upload');
MutPartForm. AddFormField (' upcount ', '1');
MutPartForm. AddFormField (' filepath 'and' data ');
MutPartForm. AddFormField (' file1 '=' ' ' 'filename + UpFileName + "' ");
MutPartForm. AddFormField (' Submit ', 'Submit');
MutPartForm. AddFile (' file1, UpFileName, 'text/plain');
Try
Response:=FHttp. Post (UpUrl MutPartForm);
Messagebox (0, PAnsiChar (response), "ca", MB_OK);
The finally
MutPartForm. Free;
FHttp. Free;
end;
end;
End.
CodePudding user response:
Please pass by, help me to look at, what needs to be done on the server configurationCodePudding user response:
Web server default asp file upload is not allowed in, so need to related web server configuration,CodePudding user response: