登录 用户中心() [退出] 后台管理 注册
 

热门搜索:
您的位置:首页 >> 马上代码 >> 马上代码 >> 主题: [delphi7]上传一个文件
标题 [delphi7]上传一个文件
clq
浏览(2015) 2007-12-30 11:33:40 发表 编辑

关键字:

[delphi7]上传一个文件

procedure TForm1.Button1Click(Sender: TObject);
var
responseStream : TStringStream;
mpfSource : TIdMultiPartFormDataStream;
begin
mpfSource := TIdMultiPartFormDataStream.Create;
responseStream := TStringStream.Create('');
try
IdHTTP1.Request.ContentType := mpfSource.RequestContentType;
mpfSource.AddFormField('var1', '1111111111111111');
mpfSource.AddFormField('var2', '2222222222222222');
mpfSource.AddFile('userfile', 'C:\Documents and Settings\Administrator\桌面\1.txt', 'file');
//mpfSource.PrepareStreamForDispatch;
mpfSource.Position := 0;
//IdHTTP1.Post('http://serwer/test.asp', mpfSource, responseStream);
IdHTTP1.Post('http://127.0.0.1:8022/index.csp', mpfSource, responseStream);
finally
mpfSource.free;
responseStream.free;
end;

end;

--------------------------------------------------
PrepareStreamForDispatch 在delphi 7 中不支持,不知为什么。我自己还是非常喜欢 delphi 的。


总数:0 页次:1/0 首页 尾页  


发表评论:
文本/html模式切换 插入图片 文本/html模式切换


附件:




Copyright © 2005-2012 CLQ工作室, All Rights Reserved

CLQ工作室 版权所有