Hi
I use fileupload control to upload image below is code:
protected void BtnUpload3Img_Click(object sender, EventArgs e)
{
uploadImageError.Visible = true;
if (fup3.HasFile && fup3.PostedFile.ContentLength < 102400)
{
string path = Server.MapPath("~/image/House/product/");
string fileName = System.IO.Path.GetFileName(fup3.PostedFile.FileName);
if (Array.IndexOf(new string[] { ".jpg", ".png" }, System.IO.Path.GetExtension(fup3.PostedFile.FileName).ToString().ToLower()) < 0)
{
uploadImageError.Text = "please upload .jpg or .png files";
return;
}
while (System.IO.File.Exists(path + "\\" + fileName))
{
fileName = "1" + fileName;
}
fup3.PostedFile.SaveAs(path + fileName);
ViewState["Id"] = House_p.SaveImageName3(fileName, Session["behcode"].ToString(), Convert.ToInt32(ViewState["Id"]));
uploadImageError.Text = "*Upload successfully";
this.imgProduct3.ImageUrl = GetThumbNail("~/image/house/product/" + fileName);
lblProduct3.Visible = upUploadImage3.Visible = !(btnDeleteImage3.Visible = imgProduct3.Visible = true);
lblErrorSubmit.Text = " ";
imgProduct3.Visible = true;
}
else
{
uploadImageError.Text = "please upload files with less than 100KB";
}
}
in above code I define format of image that user can upload .png or .jpg image and size of image should be lessthan 100KB now I want define that users just can upload images with dimension 1007*143 how I can do it?
best regards
Neda