mercredi 22 février 2017

Classic ASP Archive Function Only Archiving Fist File

Issue

I have an ASP function which is supposed to archive files based on which the user checks. For some reason, it is only archiving the first file.

For example, if the user checks the file BD_Test1.txt and Test2.txt the compressed file will only contain BD_Test1.txt.

HTML Code

<form method="post">
    Resume 1 <input type="checkbox" name=check1 value="BD_Test1.txt"><br>
    Resume 2 <input type="checkbox" name=check1 value="BD_Test2.txt"><br>
    Resume 3 <input type="checkbox" name=check1 value="BD_Test3.txt"><br>
    Resume 4 <input type="checkbox" name=check1 value="BD_Test4.txt"><br>
    Resume 5 <input type="checkbox" name=check1 value="BD_Test5.txt"><br>
    Resume 6 <input type="checkbox" name=check1 value="BD_Test6.txt"><br>
    Resume 7 <input type="checkbox" name=check1 value="BD_Test7.txt"><br>
    Resume 8 <input type="checkbox" name=check1 value="BD_Test8.txt"><br>
    Resume 9 <input type="checkbox" name=check1 value="BD_Test9.txt"><br>
    Resume 10 <input type="checkbox" name=check1 value="BD_Test10.txt"><br>
    <br><input type = "submit" name="zipFile" value = "Download"/><br>
</form>

<br><br>

<%
If (Request.Form("zipFile") <> "") Then
    Call archiveFile()
End If
%>

ASP Code

Function archiveFile()
    Dim request_Value, request_File
    Dim compress_Zip
    Dim i

    request_Value = Request("check1")
    request_File = split(request_Value,",")

    Set compress_Zip = Server.CreateObject("XStandard.Zip")

    For i = LBound(request_File) to UBound(request_File)
        compress_Zip.pack Server.MapPath("resumes/" & request_File(i)), Server.MapPath("compressed/BD_Compressed.zip")
    Next

    Set compress_Zip = Nothing
End Function




Aucun commentaire:

Enregistrer un commentaire