1
Answer

how to upload default image into database

parthiban karnan

parthiban karnan

11y
1.4k
1

i have to insert default image into databse..when no image is selected from fileupload control..

code...not working for inserting  default image...

if (FileUpload1.HasFile)
{
string FileName = System.IO.Path.GetFileName(FileUpload1.PostedFile.FileName);
FileUpload1.SaveAs(Server.MapPath("~/UPLOADEDFILES/" + FileName));
feedBack.Attachments.Add(new Attachment(FileUpload1.PostedFile.InputStream, FileName));
}

else
{
string filename="~/images/"+ "sun.gif";
filename.pPropertyImage = filename;
FileUpload1.SaveAs(MapPath(filename));



}

Answers (1)