请教高手解决TidHttp的使用,绝对难题!(50分)

B

bylove

Unregistered / Unconfirmed
GUEST, unregistred user!
[?]用TidHttp9.0.11 for Delphi5编程,从服务器下载一个Zip压缩包,也可以下载,发现下载后存到本地硬盘的文件也为Zip文件,但是解压缩错误,分析后发现Zip文件头里面有个标识:0fe6,文件末尾有个0000,据我分析,估计是TidHttp组件添加的自己的识别代码,请教高手,如何下载后去掉这两个前置和末尾的代码,多谢帮助!
下载方法类似如下:
procedure DownFile(sName, DName: string);
var
Response: TFileStream;
HttpDown: TIdHTTP;
begin
HttpDown := TIDHttp.Create(nil);
try
HttpDown.Request.ProxyPort := 80;
HttpDown.Request.ContentType := 'application/x-www-form-urlencoded';
Response := TFileStream.Create(DName, fmCreate);
try
HttpDown.Get(sName, response);
finally
Response.Free;
end;
finally
HttpDown.free;
end;
end;
 
http1 := TIdHttp.Create(self);
FileContent := http1.Get(ServerUrl + '/GetTheFile?FileName=' + httpEncode(RemoteDir + '/' + LV.Selected.Caption ));
http1.Free ;
if fileexists(Localdir+LV.Selected.Caption ) then
deletefile(Localdir+LV.Selected.Caption );
assignfile(F, Localdir+LV.Selected.Caption );
rewrite(f);
for i := 1 to length(filecontent) do
begin
write(f,filecontent);
end;
closefile(f);


我是这样弄得 没问题 不妨试一下
 
顶部