Hi,
sir i am uploading an image through file upload asp.net control
i want the default image to be uploaded when user did not select any file for upload
i am unable to upload the default image if user is not selecting any image or forgot to select
how can i upload the default image to be uploaded.
if (Singleimage.HasFile)
{
string str2 = Singleimage.FileName;
Singleimage.PostedFile.SaveAs(Server.MapPath(".") + "/singleimage/" + str2);
path2 = "/singleimage/" + str2.ToString();
// Response.Write("Property Loaded Successful");
// Here We will upload image with watermark Text
string fileName = Guid.NewGuid() + Path.GetExtension(Singleimage.PostedFile.FileName);
System.Drawing.Image upImage = System.Drawing.Image.FromStream(Singleimage.PostedFile.InputStream);
using (Graphics g = Graphics.FromImage(upImage))
{
// For Transparent Watermark Text
int opacity = 200; // range from 0 to 255
//SolidBrush brush = new SolidBrush(Color.Red);
SolidBrush brush = new SolidBrush(Color.FromArgb(opacity, Color.White));
Font font = new Font("Arial", 20);
g.DrawString("Rebiz.co", font, brush, new PointF(300, 320)); //txtWatermarkText.Text.Trim()
upImage.Save(Path.Combine(Server.MapPath("~/singleimage/"), fileName));
//Image1.ImageUrl = "~/UploadFiles" + "//" + fileName;
}
}
else
{
Response.Write("Property Not Load");
Singleimage.ImageUrl = "~/PropertyImage/abc.jpg"
}