如何使用Indy 的IdHTTP控件上传文件到Web服务器上
展开全部
代码
procedure TForm1.Button4Click(Sender: TObject);
var
response:TStringStream;
MMPFDS:TMsMultiPartFormDataStream;
begin
MMPFDS:=TMsMultiPartFormDataStream.Create;
response:=TStringStream.Create('');
idhttp1.Request.ContentType:=MMPFDS.RequestContentType;
MMPFDS.AddFile('file1','c:\temp\tuneup.txt','text/plain');
MMPFDS.PrepareStreamForDispatch;
procedure TForm1.Button4Click(Sender: TObject);
var
response:TStringStream;
MMPFDS:TMsMultiPartFormDataStream;
begin
MMPFDS:=TMsMultiPartFormDataStream.Create;
response:=TStringStream.Create('');
idhttp1.Request.ContentType:=MMPFDS.RequestContentType;
MMPFDS.AddFile('file1','c:\temp\tuneup.txt','text/plain');
MMPFDS.PrepareStreamForDispatch;
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询