i try to upload documnets and save in database and in directory
but it saves in directory not able to save in database
here i upload code
if (FileUploadControl.PostedFile != null && FileUploadControl.PostedFile.ContentLength > 0)
{
if (FileUploadControl.FileContent.Length < 100000)
{
string filename = Path.GetFileName(FileUploadControl.PostedFile.FileName);
string folder = Server.MapPath("~/Docfiles/");
Directory.CreateDirectory(folder);
FileUploadControl.PostedFile.SaveAs(Path.Combine(folder, filename));
try
{
cc.fileupladdd(Txt_docde.Value, txt_dname.Value, FileUploadControl.FileName, Convert.ToInt32(Docdrop.SelectedValue), Convert.ToInt32(DepTypeee.SelectedValue), Convert.ToInt32(Session["UserID"]));
StatusLabel.ForeColor = System.Drawing.Color.Green;
StatusLabel.Text = "Success";
}
catch
{
StatusLabel.ForeColor = System.Drawing.Color.Red;
StatusLabel.Text = "Failed";
}
}
else
{
StatusLabel.ForeColor = System.Drawing.Color.Red;
StatusLabel.Text = "File Size to big";
}
}
Txt_docde.Value = "";
txt_dname.Value = "";
}
}
and here is
sp
ALTER procedure [dbo].[fileuplaod]
@DocDesciption nvarchar(50),
@DocName nvarchar(50),
@Uploadfile nvarchar(50),
@DocTypeID int,
@DepID int,
@UserID int
as
insert into DocumentInfo(DocDesciption ,DocName,Uploadfile,DocTypeID,DepID ,UserID)
values(@DocDesciption,@DocName,@Uploadfile,@DocTypeID,@DepID ,@UserID)
where is the problem ? please tell me