delphi idhttp续传问题
我用idhttp实现文件的某块下载,为什么每次都是把整个文件都下下来了,我设的下载部分远小于源文件大小啊?我的程序如下:unitUnit1;interfaceusesWi...
我用idhttp实现文件的某块下载,为什么每次都是把整个文件都下下来了,我设的下载部分远小于源文件大小啊?我的程序如下:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, idhttp, idantifreeze, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Edit1: TEdit;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
my:tidhttp;
an:tidantifreeze;
size:integer;
url:string;
s:tmemorystream;
begin
my:=tidhttp.Create(nil);
an:=tidantifreeze.Create(nil);
an.OnlyWhenIdle:=false;
s:=tmemorystream.Create;
url:='http://xxx.xxx.com/0001.JPG';
//my.Head(url);
//size:=my.Response.ContentLength;
//edit1.Text:=inttostr(size);
my.Request.ContentRangeStart:=1;
my.Request.ContentRangeEnd:=1700;
my.Get(url,s);
s.SaveToFile('d:\4.jpg');
s.Clear;
my.Destroy;
end;
end. 展开
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, idhttp, idantifreeze, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Edit1: TEdit;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
my:tidhttp;
an:tidantifreeze;
size:integer;
url:string;
s:tmemorystream;
begin
my:=tidhttp.Create(nil);
an:=tidantifreeze.Create(nil);
an.OnlyWhenIdle:=false;
s:=tmemorystream.Create;
url:='http://xxx.xxx.com/0001.JPG';
//my.Head(url);
//size:=my.Response.ContentLength;
//edit1.Text:=inttostr(size);
my.Request.ContentRangeStart:=1;
my.Request.ContentRangeEnd:=1700;
my.Get(url,s);
s.SaveToFile('d:\4.jpg');
s.Clear;
my.Destroy;
end;
end. 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询