UploadAndExtractZipFile.aspx Font Size:
Source Code Viewer Files: UploadAndExtractZipFile.aspx   UploadAndExtractZipFile.aspx.vb   
Config File: Web.Config   
CSS File: ExamplesStyle.css   
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="UploadAndExtractZipFile.aspx.vb" Inherits="EAUploadExamples.UploadAndExtractZipFile"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
    <HEAD>
        <title>Upload archive and extract its on the server</title>
        <link rel="stylesheet" href="ExamplesStyle.css">
        <script type="text/javascript">
            function ValidateFileExtantion()
            {
                var messageBox = document.getElementById('ValidationMessage');
                                
                if (document.getElementById('UploadingFile').value == '')                
                {
                    messageBox.innerHTML = 'Please select a file!';
                    return false;
                }
                else if (document.getElementById('ckbUnZip').checked && !EndsWith(document.getElementById('UploadingFile').value, '.zip'))
                {
                    messageBox.innerHTML = 'Only zip file can be unzipped. Please select a zip archive!';
                    return false;
                }
                
                return true;
            }
            
            function EndsWith(sourceString, matchString)
            {
                var endOfSourceString = sourceString.substring(sourceString.length - matchString.length);
                
                if (endOfSourceString.toLowerCase() != matchString.toLowerCase())
                {
                    return false;
                }
                
                return true;            
            }
        </script>
    </HEAD>
    <BODY>
        This example demonstrates how to upload a zip archive and extract it on a 
        server.<br>
        .NET Zip component <b>SharpZibLib</b> is used for extracting file on a server. 
        More about SharpZipLib library you can find on the official site: 
        http://www.icsharpcode.net/OpenSource/SharpZipLib/
        <br>
        <br>
        Extracted files will be stored to the "UploadedFiles" folder that is located in 
        the root directory of an examples.<br>
        You should grant write access to "UploadedFiles" folder to the ASP.NET process 
        identity(typically {MACHINE}\ASPNET on IIS 5<BR>
        or Network Service on IIS 6).
        <br>
        <br>
        <form id="Form1" method="post" runat="server" enctype="multipart/form-data" onsubmit="return ValidateFileExtantion();">
            <div id="ValidationMessage" style="COLOR: #ff0000">&nbsp;</div>
            <table style="BORDER-RIGHT: medium none; BORDER-TOP: medium none; BORDER-LEFT: medium none; BORDER-BOTTOM: medium none">
                <tbody>
                    <tr>
                        <td>
                            <asp:CheckBox id="ckbUnZip" runat="server" Text="UnZip"></asp:CheckBox>
                        </td>
                        <td>
                            <input type="file" id="UploadingFile" name="UploadingFile" size="40">
                        </td>
                    </tr>
                    <tr>
                        <td align="right" colspan="2">
                            <br>
                            <asp:Button id="Button1" runat="server" Width="80px" Text="Upload"></asp:Button>
                        </td>
                    </tr>
                </tbody>
            </table>
            <br>
            <asp:Label id="lblResponse" runat="server"></asp:Label>
        </form>
        <hr>
        <a href="default.aspx" title="All examples">Other examples</a>
        <p>
            Used files: Bin\EasyAlgo.EAUpload.dll, Bin\ICSharpCode.SharpZipLib.dll, 
            web.config, UploadAndExtractZipFile.aspx, UploadAndExtractZipFile.aspx.vb, 
            ExamplesStyle.css [Optional]
        </p>
    </BODY>
</HTML>