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
Bilawal Niaz
NA
110
16.5k
How to upload multiple images at once in DB by using Asp.net
Nov 5 2016 2:55 AM
PageCode:
<asp:FileUpload AllowMultiple="true" ID="FileUpload1" runat="server" />
<asp:Button ID="Button1" runat="server" Text="Add Images" OnClick="Button1_Click" />
Backend Code:
protected void Button1_Click(object sender, EventArgs e)
{
BSL.Image obj = new BSL.Image();
obj.Image1 = FileUpload1.FileName;
obj.Image2 = FileUpload1.FileName;
obj.Image3 = FileUpload1.FileName;
obj.Image4 = FileUpload1.FileName;
obj.Image5 = FileUpload1.FileName;
Random r = new Random();
long s = r.Next(10000, 200000);
obj.Image1 = s + FileUpload1.FileName;
obj.Image2 = s + FileUpload1.FileName;
obj.Image3 = s + FileUpload1.FileName;
obj.Image4 = s + FileUpload1.FileName;
obj.Image5 = s + FileUpload1.FileName;
string path = Server.MapPath(@"Images/New/" + s + FileUpload1.FileName);
FileUpload1.SaveAs(path);
PictureHandler obj2 = new PictureHandler();
obj2.AddImage(obj);
}
Reply
Answers (
12
)
how to handle null value while getting image in asp.net
how to write sql query in linq