I want to know a proper way of saving image path to SQL server when working with ASP.net. I'm using SQL server 2005 & VB 2008.

closed as not a real question by danlefree Mar 9 '12 at 4:58

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. If this question can be reworded to fit the rules in the help center, please edit the question.

  • What do you mean by "image path"? – paulmorriss Feb 6 '12 at 15:59
  • i mean where the Image file is located in the PC C:\Users\Cheezy\Desktop\imagename like that – Cheezy Feb 6 '12 at 16:49
  • Where does the image come from? Is it hardcoded into the asp page? Has someone uploaded it? Can you give us some sample code? – paulmorriss Feb 6 '12 at 16:57
  • @paulmorriss take a example like updating your picture in a profile.nope not hardcoded.i want to upload the image then save it to the image folder and save that path to the SQL server.sorry at the moment i don have any sample code. – Cheezy Feb 6 '12 at 17:53

Once you've uploaded it will be somewhere in your webroot most likely (unless you specify otherwise)

What I've done in the past for this type of thing (using PHP though) is rename the file to something that will be unique if they're all going into the same directory (like add the timestamp to the image name at the beginning.

Then once you have that name, write only it to your DB as a varchar datatype.

When you need to call it, you should know the path where your upload script is storing the files, so you would just concat the name stored in the DB to the "img_root_path" or whatever you want to call your path to the files.

Not the answer you're looking for? Browse other questions tagged or ask your own question.