Example of Image Upload

This is a discussion on "Example of Image Upload" within the Classic ASP section. This forum, and the thread "Example of Image Upload are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > Classic ASP

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Sep 20th, 2007, 08:41
New Member
Join Date: Sep 2007
Location: gurgaon
Age: 22
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Example of Image Upload

Here we are uploading images in File System and storing path in the database.


Code (ImageUpload.aspx.cs) :-
Code: Select all
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.");
            }
        }

Last edited by karinne; Sep 25th, 2007 at 13:00. Reason: Removed links and no signatures allowed until you reach 10 posts.
Reply With Quote

  #2 (permalink)  
Old Sep 20th, 2007, 10:39
Up'n'Coming Member
Join Date: Sep 2007
Location: Wales, UK
Age: 35
Posts: 88
Thanks: 1
Thanked 0 Times in 0 Posts
Re: Example of Image Upload

Think this should be in the .NET section mate.
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
upload image webdeveloper Classic ASP 0 Aug 3rd, 2007 07:54
looking for php email form w/image upload joshlindem PHP Forum 2 Apr 24th, 2007 15:44
Setting the directory to upload an image php djme PHP Forum 2 Jan 11th, 2006 15:39
Image Upload/Delete ekendricks Classic ASP 5 Nov 18th, 2003 12:36


All times are GMT. The time now is 09:54.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43