我正嘗試使用unzip/zip類。上傳後我需要解壓zip文件。我修改了「睡眠」函數來檢查每個intSeconds值的「控制器」函數,並添加了「控制器」函數來檢查目標文件夾上的文件數量。您可以在下面看到代碼部分。在經典asp中解壓縮文件
壓縮文件成功解壓縮使用此功能,但頁面進度永不結束。使用此功能後,我需要重新啓動iis。
原始代碼上:Class CompressedFolder
<%
Set objShell = CreateObject("Shell.Application")
Set objFso = CreateObject("Scripting.FileSystemObject")
Function ExtractAll(strZipFile, strFolder)
If Not objFso.FolderExists(strFolder) Then objFso.CreateFolder(strFolder)
intCount = objShell.NameSpace(strFolder).Items.Count
Set colItems = objShell.NameSpace(strZipFile).Items
objShell.NameSpace(strFolder).CopyHere colItems, 8
Sleep 5000,strFolder,intCount + colItems.Count
End Function
function controller(path,filesCountMust)
dim stat:stat=False
set fold = objFso.getFolder(path)
set files = fold.files
if filesCountMust=files.count then
stat=True
end if
set files = nothing
set fold = nothing
controller=stat
end function
Sub Sleep(intSeconds,path,filesCountMust)
dblSeconds = intSeconds/1000
If dblSeconds < 1 Then dblSeconds = 1
dteStart = Now()
dteEnd = DateAdd("s", dblSeconds, dteStart)
do While dteEnd>=Now()
if dteEnd=Now() then
if controller(path,filesCountMust)=true then
exit do
else
Sleep intSeconds,path,filesCountMust
end if
end if
loop
End Sub
Set objShell = Nothing
Set objFso = Nothing
%>
您能夠通過代碼調試步驟?您報告的無限執行只有在'controller'總是返回false時纔可能(即總是調用遞歸) – 2013-04-25 04:00:49