Components ASP.Net

<%@ Page Language="C#" %>
<%@ Import Namespace="System.IO" %>

    protected void btnAdd_Click(object sender, EventArgs e)
    {
        if (upImage.HasFile)
        {
            if (CheckFileType(upImage.FileName))
            {
                upImage.SaveAs(MapPath(upImage.FileName));
            }
        }
    }
    bool CheckFileType(string fileName)
    {
        string ext = Path.GetExtension(fileName);
        switch (ext.ToLower())
        {
            case ".gif":
                return true;
            case ".png":
                return true;    
            case ".jpg":
                return true;            
            case ".jpeg":
                return true;
            default:
                return false;        
        }
    }
    void Page_PreRender()
    {
        string upFolder = MapPath(".");
        DirectoryInfo dir = new DirectoryInfo(upFolder);
        dlstImages.DataSource = dir.GetFiles();
        dlstImages.DataBind();
    }



    FileUpload File


    
    

            id="lblImageFile"
        Text="Image File:"
        AssociatedControlID="upImage"
        Runat="server" />
            id="upImage"
        Runat="server" />
    
    
            id="btnAdd"
        Text="Add Image"
        OnClick="btnAdd_Click" 
        Runat="server" />
    
    
            id="dlstImages"
        RepeatColumns="3"
        runat="server">
        
                    ImageUrl='<%# Eval("Name", "./{0}") %>'
            style="width:200px"
            Runat="server" />
        
        <%# Eval("Name") %>