hi
this is my table in database
product table
Image3
|
Image2
|
Image1
|
behcode
|
Id
|
|
|
|
|
|
|
|
|
|
|
i use 3 file upload control in my page that user upload 3 image for Each of the products
i set this code for first image that upload image into image column
when user click on BtnUpload button in image column insert image now for insert image1 and image2 what should i do?
protected void BtnUpload_Click(object sender, EventArgs e)
{
string path = Server.MapPath(".") + "\\../image/House\\";
string[] validext = { ".jpg", ".gif", ".png" };
string ext =
System.IO.Path.GetExtension(FUP1.PostedFile.FileName);
if (Array.IndexOf(validext, ext.ToLower()) < 0)
{
lblMessage.Text = please enter .jpg .gif .png format;
return;
}
string filename = System.IO.Path.GetFileName(FUP1.PostedFile.FileName);
while (System.IO.File.Exists(path + "\\" + filename))
filename = "1" + filename;
if (FUP1.HasFile)
{
try
{
if (FUP1.PostedFile.ContentLength < 105000)
{
AsyncFileUpload1.PostedFile.SaveAs(Server.MapPath("~/Upload") + System.IO.Path.DirectorySeparatorChar + FUP1.PostedFile.FileName);
// success message
Label20.Text = "File " + FUP1.PostedFile.FileName + " uploaded successfully.";
}
else
{
// file size limit exceeded
Label20.Text = "File size of " + Convert.ToString(FUP1.PostedFile.ContentLength / 1024 ) + " KB is exceeding the uploading limit.";
}
}
catch (Exception ex)
{
// error message
Label20.Text = "Some problem occurred while uploading the file. Please try after some time.";
}
}
else
{
// warning message
Label20.Text = "Please choose a file to upload.";
}
FUP1.PostedFile.SaveAs(path + filename);
SqlCommand _cmd = new SqlCommand("Fileup1", _cn);
_cmd.CommandType = CommandType.StoredProcedure;
string data = Server.UrlDecode(Request.QueryString["BehCode3"]);
_cn.Open();
_cmd.Parameters.AddWithValue("@image", FUP1.FileBytes);
_cmd.Parameters.AddWithValue("@Behcode", data);
_cmd.ExecuteNonQuery();
_cn.Close();
}