﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>InstantASP Community Forums / General Discussion / General Chit-Chat  / Example of Image Upload / Latest Posts</title><generator>InstantForum.NET v4.1.4</generator><description>InstantASP Community Forums</description><link>http://community.instantasp.co.uk/</link><webMaster>sales@instantasp.co.uk</webMaster><lastBuildDate>Mon, 01 Dec 2008 16:32:11 GMT</lastBuildDate><ttl>20</ttl><item><title>Example of Image Upload</title><link>http://community.instantasp.co.uk/Topic13352-23-1.aspx</link><description>Here we are uploading images in File System and storing path in the database.&lt;br&gt;&lt;br&gt;&lt;a target="_blank" href="http://www.hanusoftware.com/"&gt;http://www.hanusoftware.com&lt;/A&gt;&lt;br&gt;&lt;br&gt;Code (ImageUpload.aspx.cs) :-&lt;br&gt;private void Button1_Click(object sender, System.EventArgs e)&lt;br&gt;{&lt;br&gt;//Here I am uploading images in Images folder of C drive.&lt;br&gt;int intResult=0;&lt;br&gt;string strPath = @"c:\Images\"+Path.GetFileName(File1.PostedFile.FileName);&lt;br&gt;SqlConnection con = new SqlConnection("server=.;uid=sa;database=pubs;pwd=");&lt;br&gt;SqlCommand com = new SqlCommand("Insert into Category(name,imagepath) values(@name,@imagepath)",con);&lt;br&gt;com.Parameters.Add("@name",TextBox1.Text);&lt;br&gt;com.Parameters.Add("@imagepath",strPath);&lt;br&gt;con.Open();&lt;br&gt;intResult = Convert.ToInt32(com.ExecuteNonQuery());&lt;br&gt;if(intResult != 0)&lt;br&gt;{&lt;br&gt;File1.PostedFile.SaveAs(strPath);&lt;br&gt;Response.Write("Record Inserted.");&lt;br&gt;}&lt;br&gt;}&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;a target="_blank" href="http://www.hanusoftware.com/"&gt;Software Development Company&lt;/A&gt;</description><pubDate>Thu, 20 Sep 2007 03:46:26 GMT</pubDate><dc:creator>hanusoftware</dc:creator></item></channel></rss>