Stored Url In Database by File Upload Control

Dotnet4ashu
Posted by Dotnet4ashu under ASP.NET category on | Points: 40 | Views : 1886
protected void btnupload_Click(object sender, EventArgs e)
{
if (Uploadurl.PostedFile != null)
{
HttpPostedFile file = Uploadurl.PostedFile;
int filelen = file.ContentLength;
byte[] by = new byte[filelen];
file.InputStream.Read(by, 0, filelen);
cmd = new SqlCommand("Insert into url_table (url)" + "values(@url)", con);
con.Open();
cmd.Parameters.Add("@url", SqlDbType.VarChar).Value = Uploadurl.FileName;
cmd.ExecuteNonQuery();
con.Close();



}

Comments or Responses

Posted by: T.Saravanan on: 2/28/2012 Level:Silver | Status: [Member] [MVP] | Points: 10
Kindly post your code inside the code tag.

Login to post response