File Upload prob.... |
| shreya verma posted at 09-May-08 04:25 |
why this is error is here????
Could not find a part of the path 'E:\SkillInventory1\Uploads\link for message plz wait.txt'.
when i upload a file through browse button and update it this error is coming
and if m not uploading the file then updation is not done it's not working
See code
protected void btnUpdate2_Click(object sender, EventArgs e)
{
string EmpID = (string)Request.QueryString["empid"];
try
{
if (FileUpload1.FileName != "")
{
string strSource = FileUpload1.PostedFile.FileName;
string strDestination = AppDomain.CurrentDomain.BaseDirectory + "Uploads\\" + FileUpload1.FileName;
File.Copy(strSource, strDestination);
}
string constr = ConfigurationManager.ConnectionStrings["ConStr"].ToString();
SqlConnection con = new SqlConnection(constr);
con.Open();
SqlCommand cmd = new SqlCommand("[Usp_UpdateProfile]", con);
cmd.Parameters.AddWithValue( "@name", txtEmpName.Text);
cmd.Parameters.AddWithValue( "@mysiteurl", txtMySiteURL.Text);
cmd.Parameters.AddWithValue( "@ro", txtRO.Text);
cmd.Parameters.AddWithValue( "@email", txtEMail.Text);
cmd.Parameters.AddWithValue( "@resume", FileUpload1.FileName.ToString());
cmd.Parameters.AddWithValue( "@empid", EmpID);
cmd.CommandType = CommandType.StoredProcedure;
cmd.ExecuteNonQuery();
con.Close();
}
catch (Exception ex)
{
Response.Write(ex.Message);
}
Directory.CreateDirectory(MapPath(".") + "\\ Uploads ");
} |
|