读写数据都可以,但是最后没有在远程创建文件,大家帮忙看看
  ARemoteServer := 'localhost';
  AUser := '';
  APass := '';
  ARemoteFile := 'upload.doc';
  ALocalFile := 'D:\temp\upload.doc';
  HttpNet := InternetOpen(PChar(ARemoteServer), INTERNET_OPEN_TYPE_PRECONFIG, nil, nil, 0);
  if HttpNet = nil then
  begin
    RaiseLastOSError;
  end;
  try
    HttpConnect := InternetConnect(HttpNet, PChar(ARemoteServer), 0, PChar(AUser),
    PChar(APass), INTERNET_SERVICE_HTTP, 0, 0);
    if HttpConnect = nil then
    begin
      RaiseLastOSError;
    end;
     try
      HttpRequest := HttpOpenRequest(HttpConnect, 'PUT', PChar(ARemoteFile),
        nil, nil, nil, 0, 0);
      if HttpRequest = nil then
      begin
        RaiseLastOSError;
      end;
      try
        hFile := CreateFile(PChar(ALocalFile), GENERIC_READ, FILE_SHARE_READ,
          nil, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
        if hFile = 0 then
        begin
          RaiseLastOSError;
        end;
      try
        FillChar(BufferIn, SizeOf(BufferIn), 0);
        BufferIn.dwStructSize := SizeOf(BufferIn);
        BufferIn.dwBufferLength := cBuffsize;
        BufferIn.dwBufferTotal := GetFileSize(hFile, nil);
        HttpSendRequestEx(HttpRequest, @BufferIn, nil, HSR_INITIATE, 0);
        ReadInF := 0;
        repeat
          SetLength(pBuffer, cBuffsize);
          ReadFile(hFile, Pointer(pBuffer)^, cBuffsize, Count, nil);
          ReadInF := ReadInF + Count;
          InternetWriteFile(httpRequest, Pointer(pBuffer), Count, oBytesWritten);
//          ShowMessage('Written:'+IntToStr(oBytesWritten));
//          ShowMessage('Read:'+IntToStr(ReadInF));          
        until ReadInF >= BufferIn.dwBufferTotal;
        ShowMessage('OK');
      finally
        CloseHandle(hFile);
      end;
    finally
      HttpEndRequest(HttpRequest, nil, 0, 0);
      InternetCloseHandle(HttpRequest);
    end;
  finally
    InternetCloseHandle(HttpConnect);
  end;
  finally
    InternetCloseHandle(HttpNet);
  end;