3 Replies - 17159 Views - Last Post: 19 June 2013 - 11:30 PM

#1 javedparamount   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 38
  • Joined: 28-July 09

Storing Image Path in SQL server Database

Posted 27 May 2013 - 09:41 PM

I am new to ASP.Net. I am working on a website containing images. I want to store images in a folder named "images" and image path with some other information will be stored in a database.

Note: User will not be able to upload images but only me

From a Page user will click on any product and can check large image with other information on a different page. (This large image path and other information will come from database).

Is This A Good Question/Topic? 0
  • +

Replies To: Storing Image Path in SQL server Database

#2 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 14924
  • View blog
  • Posts: 59,575
  • Joined: 12-June 08

Re: Storing Image Path in SQL server Database

Posted 28 May 2013 - 06:31 AM

What's the question? You have a file name, you have the path, both are strings - aka VARCHARs, and it should be a simple process to insert a string into the table!
Was This Post Helpful? 0
  • +
  • -

#3 javedparamount   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 38
  • Joined: 28-July 09

Re: Storing Image Path in SQL server Database

Posted 16 June 2013 - 06:03 PM

View Postmodi123_1, on 28 May 2013 - 06:31 AM, said:

What's the question? You have a file name, you have the path, both are strings - aka VARCHARs, and it should be a simple process to insert a string into the table!

Question is that how to upload image into folder named "images". you are right i have file name, file path but i don't know how to upload images by entering image name and path.
Was This Post Helpful? 0
  • +
  • -

#4 jace75   User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 31
  • Joined: 11-June 13

Re: Storing Image Path in SQL server Database

Posted 19 June 2013 - 11:30 PM

Oh, you might not be fully taking advantage of the Microsoft API. There are several controls for uploading files of all types.

http://asp.net-tutor...upload-control/

Once the file is uploaded, you'll simply pass "~/images/" to the SaveAs function shown in the tutorial from the link above. File naming conventions vary form server to server, so you may have to jiggle it a little before it all lights up ;) Along with saving the image file, go ahead and add the full path to your database and you should be good to go.

Happy coding!

I just noticed I might have been slightly misleading about that parameter. You'll still need to add the file name, just be sure to give the folder where you want the file to be stored. It will look alot like this...

FileUploadControl.SaveAs(Server.MapPath("~/images/") + filename);


Was This Post Helpful? 0
  • +
  • -

Page 1 of 1