用NMTTP下载文件。是不是有大小限制?
为什么下载小文件正常。。下一个2.4M的文件就出错了。
错误信息为:socket 发送错误!
procedure TForm1.FormCreate(Sender: TObject);
begin
NMHTTP1.InputFileMode:=true;
NMHTTP1.TimeOut:=2000;
NMHTTP1.Body:='tempfileName';
NMHTTP1.Header:='HeaderFileName';
ProgressBar1.Min:=0;
ProgressBar1.Max:=100;
ProgressBar1.Position:=0;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
NMHTTP1.Get(edtURL.Text);
end;
procedure TForm1.NMHTTP1Success(Cmd: CmdType);
var
filName:string;
buf:string;
pnewfile,poldFile:pchar;
i:integer;
begin
filName:=NMHTTP1.Body;
for i:=length(edtURL.Text) downto 1 do
if edtURL.Text[i]<>'/' then
buf:=edtURL.Text[i]+buf
else
break;
GetMem(poldFile,length(filName)+1);
strPcopy(poldFile,filName);
GetMem(pnewFile,length(filName)+1);
strPcopy(pnewFile,buf);
MoveFile(poldFile,pnewFile);
freemem(poldfile);
FreeMem(pNewFile);
statusbar1.Panels.Items[0].Text:='下载完成';
tempFileName.Caption:=filName;
finalFileName.Caption:=buf;
end;