•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the ASP.NET section within the Web Development category of DaniWeb, a massive community of 423,511 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 4,705 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our ASP.NET advertiser: Lunarpages ASP Web Hosting
Views: 1315 | Replies: 0
![]() |
•
•
Join Date: Sep 2007
Posts: 6
Reputation:
Rep Power: 0
Solved Threads: 0
Here we are uploading images in File System and storing path in the database.
http://www.hanusoftware.com
Code (ImageUpload.aspx.cs) :-
private void Button1_Click(object sender, System.EventArgs e)
{
// Here I am uploading images in Images folder of C drive.
int intResult=0;
string strPath = @"c:\Images\"+Path.GetFileName(File1.PostedFile.FileName);
SqlConnection con = new SqlConnection("server=.;uid=sa;database=pubs;pwd=");
SqlCommand com = new SqlCommand("Insert into Category(name,imagepath) values(@name,@imagepath)",con);
com.Parameters.Add("@name",TextBox1.Text);
com.Parameters.Add("@imagepath",strPath);
con.Open();
intResult = Convert.ToInt32(com.ExecuteNonQuery());
if(intResult != 0)
{
File1.PostedFile.SaveAs(strPath);
Response.Write("Record Inserted.");
}
}
Software Development Company
http://www.hanusoftware.com
Code (ImageUpload.aspx.cs) :-
private void Button1_Click(object sender, System.EventArgs e)
{
// Here I am uploading images in Images folder of C drive.
int intResult=0;
string strPath = @"c:\Images\"+Path.GetFileName(File1.PostedFile.FileName);
SqlConnection con = new SqlConnection("server=.;uid=sa;database=pubs;pwd=");
SqlCommand com = new SqlCommand("Insert into Category(name,imagepath) values(@name,@imagepath)",con);
com.Parameters.Add("@name",TextBox1.Text);
com.Parameters.Add("@imagepath",strPath);
con.Open();
intResult = Convert.ToInt32(com.ExecuteNonQuery());
if(intResult != 0)
{
File1.PostedFile.SaveAs(strPath);
Response.Write("Record Inserted.");
}
}
Software Development Company
![]() |
•
•
•
•
•
•
•
•
DaniWeb ASP.NET Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
.net .net framework 3.0 access adsl adsl1 adsl2 adsl2+ ajax asp cable code combo connection custom data developer development dom download dropdownlist feed internet kb kbps mbit microsoft module msdn net network office per reader reuse second skin software sql testing theme throughput upload vista weather web windows workflow xml xoap 240000
- Image UPLOAD concept (PHP)
- Image didnt not appear (HTML and CSS)
- Coldfusion image upload w. javascript thumbnail preview (ColdFusion)
- Possible to let the user know the image is too large (PHP)
- Image Resizer (PHP)
- Image Upload/Acquisition (Web Developers' Lounge)
- Problems using a php generator (PHP)
- php mysql image again PLEASE HELP (PHP)
- Firefox - address bar icon - how to make one? (Site Layout and Usability)
Other Threads in the ASP.NET Forum
- Previous Thread: example of Server.Transfer and Context Handler
- Next Thread: Asp.net Sql Query


Linear Mode