반응형
procedure TForm1.Button1Click(Sender: TObject);
var
UploadFile: TIdMultiPartFormDataStream;
Outputs: TStringStream;
begin
if OpenDialog1.Execute then
begin
UploadFile := TIdMultiPartFormDataStream.Create;
Outputs := TStringStream.Create('');
try
IdHTTP.Request.ContentType := UploadFile.RequestContentType;
UploadFile.AddFormField('Mb_Num', '13');
UploadFile.AddFile('UploadList', OpenDialog1.FileName, 'application/unknown');
UploadFile.Position := 0;
try
IdHTTP.Post( 'http://www.xxxxx.com/xxxx.asp', UploadFile, Outputs);
except
ShowMessage('포스트 에러');
end;
ShowMessage( Outputs.DataString );
finally
UploadFile.Free;
Outputs.Free;
end;
end;
end;
var
UploadFile: TIdMultiPartFormDataStream;
Outputs: TStringStream;
begin
if OpenDialog1.Execute then
begin
UploadFile := TIdMultiPartFormDataStream.Create;
Outputs := TStringStream.Create('');
try
IdHTTP.Request.ContentType := UploadFile.RequestContentType;
UploadFile.AddFormField('Mb_Num', '13');
UploadFile.AddFile('UploadList', OpenDialog1.FileName, 'application/unknown');
UploadFile.Position := 0;
try
IdHTTP.Post( 'http://www.xxxxx.com/xxxx.asp', UploadFile, Outputs);
except
ShowMessage('포스트 에러');
end;
ShowMessage( Outputs.DataString );
finally
UploadFile.Free;
Outputs.Free;
end;
end;
end;
반응형