Here I have created sample that creates the directory and save file inside it.
I hope this will help you out.
HTML
<form id="form1" runat="server">
<div>
<asp:Label Text="Enter Directory Name" runat="server" />
<asp:TextBox ID="txtDirectory" runat="server" />
<br />
<asp:FileUpload ID="fu1" runat="server" /><br />
<asp:Button Text="Upload File" ID="btnUpload" runat="server" OnClick="btnUpload_Click" />
</div>
</form>
Namespace
using System.IO;
C#
protected void btnUpload_Click(object sender, EventArgs e)
{
string directoryname = txtDirectory.Text.ToString().Trim();
HttpFileCollection hfc = Request.Files;
foreach (string name in hfc)
{
HttpPostedFile hpf = hfc[name];
string filename = Path.GetFileName(hpf.FileName);
String path = Server.MapPath("~/Webimage/"+directoryname+"/");
if (!System.IO.Directory.Exists(path))
{
System.IO.Directory.CreateDirectory(path);
}
string imgPath = path + "/" + filename;
hpf.SaveAs(imgPath);
txtDirectory.Text = "";
}
}