Hi,
You can use file upload control for inserting file into Database.In file upload control button click you can write this
protected void UploadFile_Click(object sender, EventArgs e)
{
if (Fileupload.HasFile)
{
string inputfileName = Fileupload.FileName;
Fileupload.SaveAs(Server.MapPath("~/Attachments/")+ inputfileName);
ViewState["FileUploadControl"] = inputfileName;
}
}
Here attachments is the fiel storage location folder name and this viewstate value can be assigned to database url field and that can be retrievedby using any lable or textbox like this
qs.Attachment_URL = ViewState["FileUploadControl"].ToString();
string Url = ConfigurationManager.AppSettings["InputPath"] + qs.Attachment_URL;
hyplUrl.NavigateUrl = Url;
hyplUrl.Text = qs.Attachment_URL;
hyplUrl.Visible = true;
Here am using hyperlink for opening the url in another page.Input path means file storate location path taken as config file.
And qs is my class file object name.In class file am creating url variable and write connection string and added to database.