限制视频下载的最大大小

时间:2019-06-14 09:01:03

标签: html asp-classic web-config

我正在在线下载视频,我想限制允许的大小。我试图将其添加到 web.config

<httpRuntime executionTimeout ="3600" maxRequestLength ="2000" appRequestQueueLimit ="100" requestValidationMode ="2.0" requestLengthDiskThreshold ="2000000" /> 

但这不起作用。

这是我的ASP代码:

'Creation du Guid
Set TypeLib = Server.CreateObject("Scriptlet.TypeLib")
guid1 = TypeLib.Guid
guid1 = Left(guid1, Len(guid1)-2)
guid1 = replace(guid1, "{", "")
guid1 = replace(guid1, "}", "")
Set TypeLib = Nothing

'autoriser les mp4

set mySmartUpload = Server.CreateObject("aspSmartUpload.SmartUpload")
mySmartUpload.AllowedFilesList = "mp4"
mySmartUpload.DeniedFilesList = "bat,exe,com,asp,php,pdf,txt,doc,xls,jsp,aspx"
mySmartUpload.Upload
'chem="imagesCrop/"

ext1 = mySmartUpload.Files.Item(1).FileExt
video1 = cstr(guid1) & "." & ext1
set fichier1 = mySmartUpload.Files.Item(1)
fichier1.SaveAs(server.MapPath(chem) & "\" & video1)

set mySmartUpload = nothing

和我的HTML输入:

<input class="champ"  type="file" name="f1" >

1 个答案:

答案 0 :(得分:1)

您有2个解决方案。

在Web.config中:

<system.webServer>
  <security>
    <requestFiltering>
      <requestLimits maxAllowedContentLength="104857600" />
    </requestFiltering>
  </security>
</system.webServer>

这会将文件上传大小限制为100 MB

在SmartUpoad本身中:

mySmartUpload.MaxFileSize = 104857600

那也是100 MB。