我想继续使用印(HTTP邮政)上传/上传,代码如下所示(使用德尔福2010年,印10.4736):恢复HTTP邮政与印
IdHttp.Head('http://localhost/_tests/resume/large-file.bin');
ByteRange := IdHttp.Response.ContentLength + 1;
// Attach the file to post/upload
Stream := TIdMultipartFormDataStream.Create;
with Stream.AddFile('upload_file', 'D:\large-file.bin', 'application/octet-stream') do
begin
HeaderCharset := 'utf-8';
HeaderEncoding := '8';
end; // with
with IdHTTP do
begin
IOHandler.LargeStream := True;
with Request do
begin
ContentRangeStart := ByteRange;
ContentRangeEnd := (Stream.Size - ByteRange);
ContentLength := ContentRangeEnd;
ContentRangeInstanceLength := ContentLength;
end; // with
Post('http://localhost/_tests/resume/t1.php', Stream);
end; // with
但上传简历没有“T工作:(
我看着Indy的代码,似乎这个功能IdIOHandler.pas
TIdIOHandler.Write()
总是处理完整的流/文件(因为参数ASize:TIdStreamSize似乎总是0,根据代码意味着发送完整的文件/流)。
这可以防止indy恢复上传。
我的问题是:是否可以避免发送完整的文件?
设置内容范围没有改变任何东西。我还调整了Indy的代码(修改后的3线),使印服从的含量范围/流的位置,但它是越野车和印地最后总是挂在IdStackWindows.pas因为无限超时这里:
TIdSocketListWindows.FDSelect()
你应该为此使用'PUT'。 – OnTheFly 2012-03-07 13:23:12
这里是雷米勒博[说一下放](http://stackoverflow.com/questions/9476744/how-to-optimize-upload-routine-using-delphi-2010#comment12034421_9492180) – TheDude 2012-03-07 13:56:44
不知道,他大概在PHP4会谈。但是,是的,你的愿望与POST不兼容。 – OnTheFly 2012-03-07 14:56:05