You'd dynamically create the control like this
<asp:Panel ID="PanelContainer" runat="server">
</asp:Panel>
<asp:Button ID="ButtonUpload" runat="server" OnClick="ButtonUpload_Click" Text="Upload" />
<asp:Literal ID="LiteralMessage" runat="server" Visible="false" EnableViewState="false"><p>File uploaded</p></asp:Literal>
code-behind
protected void Page_Load(object sender, EventArgs e)
{
FileUpload fu = new FileUpload();
fu.ID = "MyFileUpload";
PanelContainer.Controls.Add(fu);
}
protected void ButtonUpload_Click(object sender, EventArgs e)
{
FileUpload fu = PanelContainer.FindControl("MyFileUpload") as FileUpload;
if (fu != null && fu.HasFile)
{
fu.SaveAs(Server.MapPath(string.Concat("~/app_data/", fu.FileName)));
LiteralMessage.Visible = true;
}
}