hi,
here is the modified code for you
if (System.IO.File.Exists(pimage))
{
try
{
if (pimage.PostedFile.ContentLength < 20480)
{
string filename = pimage.FileName;
pimage.SaveAs(Server.MapPath("~//Images//" + filename ));
upload1.Text = "uploaded";
}
else
{
Response.Write("File has to be less than 1 MB");
}
}
catch (Exception ex)
{
upload1.Text = ex.Message.ToString();
}
}
else
{
upload1.Text = "You Had Not Specified a File";
}
hope this will help you