TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Mukesh
NA
228
42.5k
How to Upload Multiple File in Multiple Column In Database
Mar 22 2017 3:22 AM
Hello
I Want To Know How to Save Multiple File in Multiple Column In Database I give You My Code Below so Please Write Code for Me--
This is my Class where I Make Function---
public DataSet InsertRecord(DCI_BAL objprop)
{
CommanFunction cmf = new CommanFunction();
MyConnectionString objcon = new MyConnectionString();
string myconnection = objcon.Constring;
int Querytype = 0; // for Query type i.e. parameter or SP
string SPName = "Proc_Anti_Ragging1";
string Qtype = objprop.Qtype;
string[,] MySPValues = new string[,]
{
{"@Qtype",Qtype},
{"@Year", objprop.Year},
{"@Prospectus_mention_File1",objprop.Prospectus_mention_File1},
{"@Prospectus_mention_File2",objprop.Prospectus_mention_File2},
{"@Prospectus_mention_File3",objprop.Prospectus_mention_File3},
{"@Prospectus_mention_File4",objprop.Prospectus_mention_File4},
{"@Prospectus_mention_File5",objprop.Prospectus_mention_File5}
};
DataSet ds = new DataSet();
ds = cmf.Execute_DSSPQuery(myconnection, Querytype, SPName, MySPValues);
return ds;
}
/////////////////////////////////////////////
And Now i Share You My Cs Page of Button Click ---
protected void btnsubmit_Click(object sender, EventArgs e)
{
DCI_BAL objDCI_BAL = new DCI_BAL();
DataSet ds = new DataSet();
string collegeId = Session["CollegeId"].ToString();
objDCI_BAL.Qtype = "1";
objDCI_BAL.CollegeId = collegeId;
objDCI_BAL.Prospectus_mention_File1 = flpProspectus.;
objDCI_BAL.Prospectus_mention_File2 = flpProspectus.;
objDCI_BAL.Prospectus_mention_File3 = flpProspectus.;
objDCI_BAL.Prospectus_mention_File4 = flpProspectus.;
objDCI_BAL.Prospectus_mention_File5 = flpProspectus.;
}
and Hear is File Upload Code-----
if (flpProspectus.HasFile)
{
string fileExtension = System.IO.Path.GetExtension(flpProspectus.FileName);
int fileSize = FileUpload2.PostedFile.ContentLength;
// If file size is greater than 2 MB
if (fileSize > 2097152)
{
Label2.ForeColor = System.Drawing.Color.Red;
Label2.Text = "File size cannot be Less than 2 MB";
}
else
{
HttpFileCollection hfc = Request.Files;
for (int i = 0; i < hfc.Count; i++)
{
HttpPostedFile hpf = hfc[i];
if (hpf.ContentLength > 0)
{
hpf.SaveAs(Server.MapPath("~/college/fileupload3/") +System.IO.Path.GetFileName(hpf.FileName));
}
}
}
}
else
{
lblMessage.ForeColor = System.Drawing.Color.Red;
lblMessage.Text = "Please select a file";
}
I Want To Know--
File Upload Id is flpProspectus and i want to upload 5 file in this column which is on my button click event
Column Name--
Prospectus_mention_File1
Prospectus_mention_File2
Prospectus_mention_File3
Prospectus_mention_File4
Prospectus_mention_File5
so How to call file upload and save into database
please help
Reply
Answers (
1
)
how to show next and previous button reccord form database
userdeatil in gridview