求Delphi的能上传比较大文件的WebApplication程序(TWebRequest.ReadClient或者TWebRequest.ReadString

  • 主题发起人 主题发起人 憔悴
  • 开始时间 开始时间

憔悴

Unregistered / Unconfirmed
GUEST, unregistred user!
求Delphi的能上传比较大文件的WebApplication程序(TWebRequest.ReadClient或者TWebRequest.ReadString用法)。 (50分)<br />ISAPI或者CGI程序,客户端可以上传文件到服务器。
我试过,有一个问题,就是Request.Content的大小范围在50000字节左右,超过这个大小
,就要用TWebRequest.ReadClient或者TWebRequest.ReadString来读取剩下的字节。以下
是帮助文件说明:
function ReadClient(var Buffer; Count: Integer): Integer; virtual; abstract;
Description
Descendants of TWebRequest implement ReadClient. ReadClient is used to read
content information from the HTTP request. Use ReadClient to get the next
chunk of information when the content of the request message is too large
for the Content property.
Use Buffer to provide a buffer to contain the content information. Use Count
to specify the number of bytes to read. ReadClient returns the number of bytes
actually read.

function ReadString(Count: Integer): string; virtual; abstract;
Description
Descendants of TWebRequest implement ReadString. ReadString is used to load
content information from the HTTP request into a string. Use ReadString to get
the next chunk of information when the content of the request message is too
large for the Content property.

但是如何判断上传字节大小超过Request.Content的极限呢?TWebRequest.ReadString好像
只能读剩下的16K字节,超过16K就要多使用一个TWebRequest.ReadString,比如我要上传
100K的文件,可能就要FContentData:=FContentData+Request.ReadString(70000)+
Request.ReadString(70000)+Request.ReadString(70000)+Request.ReadString(70000);

总之,TWebRequest.ReadClient或者TWebRequest.ReadString用法我不怎么会,希望大家
指点指点!
 
找到答案了。
 
接受答案了.
 
憔悴先生:
您好!通过HTTP上传文件(二进制)正是我需要的,您是怎样解决的,谢谢!Request.Content是
一个字符串,如何能读取客户通过POST发送过来的文件,并保存在本地上?
 
后退
顶部