protected void fileupload(object sender, EventArgs e)
{
string exp = System.IO.Path.GetExtension(FileUpload1.FileName).TrimStart(".".ToCharArray()).ToLower();
if ((exp="jpeg")&&(exp="jpg")&&(exp="png")&&(exp="gif")&&(exp="bmp"))
{
if (FileUpload1.HasFile == true) //checking fileuploader contain any file or not
{
FileUpload1.SaveAs(Server.MapPath("test.jpg"));// to save the uploaded file if it this step is not used we cannot display the picture in image control and server.mappath is used to get the full path of the image
Image1.ImageUrl = "test.jpg";
}
}
}
No comments:
Post a Comment