This will create a folder directory as follows
~/Images/Flower/April_2014/FileName.jpg
HTML:
<form id="form1" runat="server">
<div>
Please Select Category
<asp:DropDownList ID="ddlCategories" runat="server" AutoPostBack="true" OnSelectedIndexChanged="Categories_OnSelectedIndexChanged">
<asp:ListItem Text="Please Select" Value="0" />
<asp:ListItem Text="Animal" Value="Animal" />
<asp:ListItem Text="Flower" Value="Flower" />
</asp:DropDownList>
<br />
<br />
Please Select Year and Month
<asp:DropDownList ID="ddlMonths" runat="server">
<asp:ListItem Text="April" Value="April" />
<asp:ListItem Text="May" Value="May" />
</asp:DropDownList>
<asp:DropDownList ID="ddlYears" runat="server">
<asp:ListItem Text="2014" Value="2014" />
<asp:ListItem Text="2013" Value="2013" />
</asp:DropDownList>
<br />
<br />
<asp:FileUpload ID="FileUpload1" runat="server" />
<br />
<br />
<asp:Button ID="btnUpload" runat="server" Text="Upload" OnClick="Upload" />
<hr />
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false" ShowHeader="false">
<Columns>
<asp:BoundField DataField="Text" />
<asp:ImageField DataImageUrlField="Value" ControlStyle-Height="100" ControlStyle-Width="100" />
</Columns>
</asp:GridView>
</div>
</form>
C#:
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
this.PopulateGridView(this.ddlCategories.SelectedItem.Value);
}
}
protected void Upload(object sender, EventArgs e)
{
if (this.FileUpload1.HasFile)
{
string yearMonth = string.Format("{0}_{1}", this.ddlMonths.SelectedItem.Value, this.ddlYears.SelectedItem.Value);
DirectoryInfo directoryInfo = new DirectoryInfo(Server.MapPath("~/Images/" + this.ddlCategories.SelectedItem.Value + "/" + yearMonth));
if (!directoryInfo.Exists)
{
directoryInfo.Create();
}
this.FileUpload1.PostedFile.SaveAs(Server.MapPath("~/Images/" + this.ddlCategories.SelectedItem.Value + "/" + yearMonth + "/") + FileUpload1.FileName);
this.PopulateGridView(this.ddlCategories.SelectedItem.Value);
}
}
protected void Categories_OnSelectedIndexChanged(object sender, EventArgs e)
{
this.PopulateGridView(this.ddlCategories.SelectedItem.Value);
}
private void PopulateGridView(string category)
{
string yearMonth = string.Format("{0}_{1}", this.ddlMonths.SelectedItem.Value, this.ddlYears.SelectedItem.Value);
if (category != "0")
{
DirectoryInfo directoryInfo = new DirectoryInfo(Server.MapPath("~/Images/" + this.ddlCategories.SelectedItem.Value + "/" + yearMonth));
if (directoryInfo.Exists)
{
string[] filePaths = Directory.GetFiles(Server.MapPath("~/Images/" + category + "/" + yearMonth));
List<ListItem> files = new List<ListItem>();
foreach (string filePath in filePaths)
{
string fileName = Path.GetFileName(filePath);
files.Add(new ListItem(fileName, "~/Images/" + category + "/" + yearMonth + "/" + fileName));
}
this.GridView1.DataSource = files;
this.GridView1.DataBind();
}
else
{
this.ClientScript.RegisterStartupScript(this.GetType(), "Alert", "alert('No Such Directory Exists. Please Upload The File')", true);
}
}
}
Image:

Thank You.