hoow to inset into database default image in byte formate when not selecting image from fileupload.
protected void subbtn_Click(object sender, EventArgs e)
{
if (fp.FileContent == null)
{
Byte[] imgByte = new Byte["image/1.jpg".Length];
}
else
{
FileUpload img = (FileUpload)fp;
Byte[] imgByte = null;
if (img.HasFile && img.PostedFile != null)
{
//To create a PostedFile
HttpPostedFile File = fp.PostedFile;
//Create byte Array with file len
imgByte = new Byte[File.ContentLength];
//force the control to load data in array
File.InputStream.Read(imgByte, 0, File.ContentLength);
}
}
int k = bs.usrdtinsert(txtfname.Text, txtlname.Text, txtemail.Text, txtpwd.Text, txtdb.Text, txtmob.Text, countrylist.Text, statelist.Text, citylist.Text, RadioButtonList1.Text, imgByte, desiglist.Text, txtkey.Text);