Please check the solution provided below. Make sure that you have already set the required settings:
protected void btnUploadPic_Click(object sender, EventArgs e)
{
if(PicFileUploadCtrl.HasFile)
{
try
{
string strFileName = Path.GetFileName(PicFileUploadCtrl.FileName);
PicFileUploadCtrl.SaveAs(Server.MapPath("~/") + strFileName );
lblStatus.Text = "Pic uploaded successfully!!!";
}
catch (Exception ex)
{
lblStatus.Text = "Error while uploading the Pic.";
}
}