hi,
i created database tables in sqlserver regarding upload a file its working but now i want how to down load a file through database . i was use grid view also when i upload a file it shows through gridview and if we want to delete just click delete symbol. so, any one can under stand pls send me solution.
protected void Button1_Click(object sender, EventArgs e)
{
if (FileUpload1.HasFile)
{
// delete and content with the same name
ContentDataSource.Insert();
// insert new content
ContentDataSource.Delete();
// refresh the content list
GridView1.DataBind();
}
}
protected void ContentDataSource_Inserting(object sender, SqlDataSourceCommandEventArgs e)
{
e.Command.Parameters["@name"].Value = FileUpload1.FileName;
e.Command.Parameters["@type"].Value = FileUpload1.PostedFile.ContentType;
e.Command.Parameters["@length"].Value = FileUpload1.PostedFile.ContentLength;
e.Command.Parameters["@img"].Value = FileUpload1.FileBytes;
}
protected void ContentDataSource_Deleting(object sender, SqlDataSourceCommandEventArgs e)
{
e.Command.Parameters["@name"].Value = FileUpload1.FileName;
}