« asp POST GET cookies 防注入php时间加减处理 »

asp分段上传大文件

  Dim ReadBytes,TrunkBytes,TotalBytes
  ReadBytes = 0
  TrunkBytes = 12428800     '--分段大小,某位大大经过测试,无组件上传限制单个文件最大约≤65MB
  TotalBytes = Request.TotalBytes
  If TrunkBytes > TotalBytes Then TrunkBytes = TotalBytes

 
  Version="化境HTTP上传程序 Version 2.0"
  set objForm=Server.CreateObject("Scripting.Dictionary")
  set objFile=Server.CreateObject("Scripting.Dictionary")
  if Request.TotalBytes<1 then Exit Sub
  set tStream = Server.CreateObject("adodb.stream")
  set Data_5xsoft = Server.CreateObject("adodb.stream")
  Data_5xsoft.Type = 1
  Data_5xsoft.Mode =3
  Data_5xsoft.Open
  
  Do While ReadBytes < TotalBytes
        Data_5xsoft.Write Request.BinaryRead(TrunkBytes)
        ReadBytes = ReadBytes + TrunkBytes
        If (ReadBytes + TrunkBytes) > TotalBytes Then TrunkBytes = TotalBytes mod TrunkBytes  '最后剩下的字节
  Loop

 

这种上传办法比较费内存。

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

网站目录

最近发表

最新评论及回复

文章归档

Search

Powered By Z-Blog 1.8 Terminator(beta) Build 71218 Designed by Michael

Copyright 0-9999 subin.org.cn Rights Reserved. 晋ICP备08000685号