S
shuaikiller
Unregistered / Unconfirmed
GUEST, unregistred user!
查找了些相关资料还是没有搞定,所以特发帖来问下大家。
1:服务器用asp.net写好,可以在网页进行上传文件;
一个input框,一个浏览文件按钮和一个上传按钮;
2:delphi程序:
var
IdHttp: TIdHTTP;
MutPartForm: TIdMultiPartFormDataStream;
begin
IdHttp:=TIdHTTP.Create(nil);
MutPartForm:=TIdMultiPartFormDataStream.Create;
try
// MutPartForm.AddFormField('FieldName', 'FieldValue');
MutPartForm.AddFile('info.rar', 'd:/info.rar', 'FieldType');
MutPartForm.Position:=0;
IdHttp.Request.ContentType := MutPartForm.RequestContentType;
IdHttp.Post('http://localhost/test.aspx', MutPartForm);
finally
IdHttp.Free;
MutPartForm.Free;
end;
结果:程序没有运行后没有反应,没有错误,也没有将文件上传。顺便问下MutPartForm.AddFormField是填写网页的参数吗?谢谢!
1:服务器用asp.net写好,可以在网页进行上传文件;
一个input框,一个浏览文件按钮和一个上传按钮;
2:delphi程序:
var
IdHttp: TIdHTTP;
MutPartForm: TIdMultiPartFormDataStream;
begin
IdHttp:=TIdHTTP.Create(nil);
MutPartForm:=TIdMultiPartFormDataStream.Create;
try
// MutPartForm.AddFormField('FieldName', 'FieldValue');
MutPartForm.AddFile('info.rar', 'd:/info.rar', 'FieldType');
MutPartForm.Position:=0;
IdHttp.Request.ContentType := MutPartForm.RequestContentType;
IdHttp.Post('http://localhost/test.aspx', MutPartForm);
finally
IdHttp.Free;
MutPartForm.Free;
end;
结果:程序没有运行后没有反应,没有错误,也没有将文件上传。顺便问下MutPartForm.AddFormField是填写网页的参数吗?谢谢!