我想繼續使用印(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