if (FileUpload2.HasFile)
{
int length = FileUpload2.PostedFile.ContentLength;
byte[] imgbyte = new byte[length];
if (length> 0)
{
//int imgsize = FileUpload2.PostedFile.ContentLength;
int imagesize = length / 1024;
if (imagesize< 50)
{
string fn = System.IO.Path.GetFileName(FileUpload2.PostedFile.FileName);
string[] fname1 = fn.Split(',');
int i = fname1.Length;
string fext = fname1[i - 1];
if (fext == "jpg")
{
string serverpath = Server.MapPath("./employeephoto/");
string filelocation = serverpath + "\\" + f[0] + "."+ fext;
FileUpload2.PostedFile.SaveAs(filelocation);
Label2.Text = "The Image has been uploaded successfully";
}
lblerror.Text = "Record updated successfully"