how to File Uploading and Downloading with FileType & Length Validation

Default.aspx

           <asp:FileUpload ID="FileUpload1" runat="server" />
           <asp:Button ID="Button1" runat="server" Height="23px" Text="Upload"
                   Width="68px" onclick="Button1_Click" />

           <asp:Button ID="Button2" runat="server" Text="Download" Width="167px"
                   onclick="Button2_Click" />

           <asp:Label ID="Label1" runat="server" Height="25px" >.</asp:Label>
 
Default.aspx.CS

    protected void Button1_Click(object sender, EventArgs e)
     {
        if (FileUpload1.HasFile)
        {



            try
            {
               if (FileUpload1.PostedFile.ContentType == "image/jpeg" || FileUpload1.PostedFile.ContentType

                   == "image/gif")
                {
                    if (FileUpload1.PostedFile.ContentLength < 10240000)
                    {
                        string filename = System.IO.Path.GetFileName(FileUpload1.FileName);
                        FileUpload1.SaveAs(Server.MapPath("file/") + filename);
                        Label1.Text="File uploaded successfully!";
                        con.Open();
                        SqlCommand cmd = new SqlCommand("insert into fileupload(filename,filepath,) 

                        values(@name,@path)",con);
                        cmd.Parameters.AddWithValue("@name",filename);
                        cmd.Parameters.AddWithValue("@path", "file/" + filename);
                        cmd.ExecuteNonQuery();
                        con.Close();
                    }
                    else
                    {
                        Label1.Text="File maximum size is 10 mb";
                    }
                   
                }
                else
                {
                    Label1.Text="Only JPEG & GIF files are accepted!";
                }
            }
            catch(Exception ex)
            {
                Label1.Text=ex.Message;
            }
        }
    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        Response.ContentType = "image/jpeg";
        Response.ContentType = "image/png";
        Response.AppendHeader("Content-Disposition", "attachment; filename=test.jpg");
        Response.TransmitFile(Server.MapPath("file/test.jpg"));
        Response.End();

    }